26 lines
746 B
C#
26 lines
746 B
C#
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);
|
|
}
|
|
|
|
}
|
|
}
|