Esempio n. 1
0
 public GetRoleGroupsResponse GetRoleGroups(GetRoleGroupsRequest request)
 {
     var roleGroups = new List<RoleGroup>();
     if (request.Take != 0)
     {
         roleGroups = DataContext.RoleGroups.Include(x => x.Level).OrderBy(x => x.Id).Skip(request.Skip).Take(request.Take).ToList();
     }
     else
     {
         roleGroups = DataContext.RoleGroups.Include(x => x.Level).ToList();
     }
     var response = new GetRoleGroupsResponse();
     response.RoleGroups = roleGroups.MapTo<GetRoleGroupsResponse.RoleGroup>();
     return response;
 }
Esempio n. 2
0
        public GetRoleGroupsResponse GetRoleGroups(GetRoleGroupsRequest request)
        {
            int totalRecords;
            var data = SortData(request.Search, request.SortingDictionary, out totalRecords);
            if (request.Take != -1)
            {
                data = data.Skip(request.Skip).Take(request.Take);
            }

            return new GetRoleGroupsResponse
            {
                TotalRecords = totalRecords,
                RoleGroups = data.ToList().MapTo<GetRoleGroupsResponse.RoleGroup>()
            };

            //var roleGroups = new List<RoleGroup>();
            //if (request.Take != 0)
            //{
            //    roleGroups = DataContext.RoleGroups.Include(x => x.Level).OrderBy(x => x.Id).Skip(request.Skip).Take(request.Take).ToList();
            //}
            //else
            //{
            //    roleGroups = DataContext.RoleGroups.Include(x => x.Level).ToList();
            //}
            //var response = new GetRoleGroupsResponse();
            //response.RoleGroups = roleGroups.MapTo<GetRoleGroupsResponse.RoleGroup>();
            //return response;
        }