Exemple #1
0
        public GetMenusResponse GetMenusForGrid(GetMenusRequest request)
        {
            int totalRecords;
            var menus = SortData(request.Search, request.SortingDictionary, out totalRecords);
            if (request.Take != -1)
            {
                menus = menus.Skip(request.Skip).Take(request.Take);
            }

            var response = new GetMenusResponse();
            response.Menus = menus.ToList().MapTo<GetMenusResponse.Menu>();
            response.TotalRecords = totalRecords;

            return response;
        }
Exemple #2
0
        public GetMenusResponse GetMenus(GetMenusRequest request)
        {
            IQueryable<Data.Entities.Menu> menus;
            if (request.Take != 0)
            {
                menus = DataContext.Menus.AsNoTracking().OrderBy(x => x.Order).Skip(request.Skip).Take(request.Take);
            }
            else
            {
                menus = DataContext.Menus.AsNoTracking();
            }

            var response = new GetMenusResponse() { Menus = menus.MapTo<GetMenusResponse.Menu>() };

            return response;
        }