// Menu public override Task <GetMenusResponse> GetMenus(GetMenusRequest request, ServerCallContext context) { var menus = _menuDao.GetMenus(request.ParentCode); var res = new GetMenusResponse(); res.Menus.AddRange(menus.Select(m => _mapper.Map <MenuDTO>(m))); return(Task.FromResult(res)); }
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); }
public GetMenusResponse GetMenus(GetMenusRequest request) { IQueryable <Data.Entities.Menu> menus; if (request.Take != 0) { menus = DataContext.Menus.OrderBy(x => x.Order).Skip(request.Skip).Take(request.Take); } else { menus = DataContext.Menus; } var response = new GetMenusResponse() { Menus = menus.MapTo <GetMenusResponse.Menu>() }; return(response); }