Esempio n. 1
0
        public async Task <ActionResult <int> > Count([FromBody] Role_RoleFilterDTO Role_RoleFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            RoleFilter RoleFilter = ConvertFilterDTOToFilterEntity(Role_RoleFilterDTO);

            RoleFilter = RoleService.ToFilter(RoleFilter);
            int count = await RoleService.Count(RoleFilter);

            return(count);
        }
Esempio n. 2
0
        public RoleFilter ConvertFilterDTOToFilterEntity(Role_RoleFilterDTO Role_RoleFilterDTO)
        {
            RoleFilter RoleFilter = new RoleFilter();

            RoleFilter.Selects   = RoleSelect.ALL;
            RoleFilter.Skip      = Role_RoleFilterDTO.Skip;
            RoleFilter.Take      = Role_RoleFilterDTO.Take;
            RoleFilter.OrderBy   = Role_RoleFilterDTO.OrderBy;
            RoleFilter.OrderType = Role_RoleFilterDTO.OrderType;

            RoleFilter.Id       = Role_RoleFilterDTO.Id;
            RoleFilter.Code     = Role_RoleFilterDTO.Code;
            RoleFilter.Name     = Role_RoleFilterDTO.Name;
            RoleFilter.StatusId = Role_RoleFilterDTO.StatusId;
            return(RoleFilter);
        }
Esempio n. 3
0
        public async Task <ActionResult <List <Role_RoleDTO> > > List([FromBody] Role_RoleFilterDTO Role_RoleFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            RoleFilter RoleFilter = ConvertFilterDTOToFilterEntity(Role_RoleFilterDTO);

            RoleFilter = RoleService.ToFilter(RoleFilter);
            List <Role> Roles = await RoleService.List(RoleFilter);

            List <Role_RoleDTO> Role_RoleDTOs = Roles
                                                .Select(c => new Role_RoleDTO(c)).ToList();

            return(Role_RoleDTOs);
        }