Exemplo n.º 1
0
        public IEnumerable <License> GetAllLicensesEnum(string searchString)
        {
            IEnumerable <License> licenses = repository.GetAllLicensesEnum();

            if (!string.IsNullOrEmpty(searchString))
            {
                //Installed nuget package: NinjaNye.SearchExtensions (http://ninjanye.github.io/SearchExtensions/stringsearch.html) which works really good!

                licenses = licenses.Search(h => h.PurchaseItem.Product.Name ?? "",
                                           h => h.Status != null ? h.Status.Name : "",
                                           h => h.No ?? "",
                                           h => h.Key ?? "",
                                           h => h.LicenseType.Name ?? "",
                                           h => h.LicenseValidityType.Name ?? "")
                           .Containing(searchString);
            }

            return(licenses);
        }