Пример #1
0
        public PagedList <Classes> Get(ClassQueryParameters clParam)
        {
            var collection = context.Classes.AsQueryable();

            if (!string.IsNullOrWhiteSpace(clParam.ClassID) && int.TryParse(clParam.ClassID, out var intId))
            {
                collection = collection.Where(cl => cl.ClassId == intId);
            }

            if (!string.IsNullOrWhiteSpace(clParam.Name))
            {
                collection = collection.Where(cl => cl.Name.Contains(clParam.Name, StringComparison.OrdinalIgnoreCase));
            }

            collection = ReflectionHelper.PerformSorting <Classes>(clParam.OrderBy, collection);

            return(PagedList <Classes> .Create(collection, clParam.PageNumber, clParam.PageSize));
        }
Пример #2
0
 public IActionResult GetClasses([FromQuery] ClassQueryParameters classes)
 {
     return(crudService.Get(classes.Fields, classes));
 }