Exemple #1
0
        public async Task <CategoryQueryListView> GetAllCategoryTask(CategoryViewListModel query)
        {
            CategoryQueryListView queryList = new CategoryQueryListView();

            var cateList = GetAll().OrderByDescending(x => x.Modify);

            queryList.Count = cateList.Count();
            cateList        = cateList.Skip(query.Page * query.Size).Take(query.Size).OrderBy(s => s.CategoryName);
            var list = new List <CategoryViewModel>();

            foreach (Category category in cateList)
            {
                var cate = new CategoryViewModel()
                {
                    CategoryId   = category.CategoryId,
                    CategoryName = category.CategoryName,
                    Note         = category.Note,
                    Status       = category.Status,
                    Create       = category.Create,
                    CreateBy     = category.CreateBy,
                    Modify       = category.Modify,
                    ModifyBy     = category.ModifyBy
                };

                list.Add(cate);
            }
            queryList.CategoryViewModel = list.AsQueryable();
            return(queryList);
        }
 public async Task <CategoryQueryListView> GetResult([FromBody] CategoryViewListModel query)
 {
     return(await _repository.GetAllCategoryTask(query));
 }