添加项目文件。
This commit is contained in:
25
XXCpzs/Services/CustomerDataService.cs
Normal file
25
XXCpzs/Services/CustomerDataService.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using XXCpzs.Models;
|
||||
|
||||
namespace XXCpzs.Services
|
||||
{
|
||||
public class CustomerDataService
|
||||
{
|
||||
public static List<Customer> Fruits { get; set; } = new List<Customer>
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
public static List<Customer> GetSearchResults(string queryString)
|
||||
{
|
||||
var normalizedQuery = queryString?.ToLower() ?? "";
|
||||
return Fruits.Where<Customer>(f => f.company.ToLowerInvariant().Contains(normalizedQuery) || f.contacts.ToLowerInvariant().Contains(normalizedQuery) || f.phone.ToLowerInvariant().Contains(normalizedQuery)).ToList();
|
||||
}
|
||||
public static void AddItem(Customer item)
|
||||
{
|
||||
Fruits.Add(item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user