コード例 #1
0
        public async Task <PagedResponse <List <MomInfoResponse> > > GetListMomInfo(MomInfoRequest request)
        {
            var response = new List <MomInfoResponse>();
            Expression <Func <Domain.Entities.User, bool> > query = x => x.DelFlag == false &&
                                                                    x.RoleId == Constants.RoleConstant.USER_ROLE &&
                                                                    (request.FullName == null || x.UserInfo.FullName.Contains(request.FullName)) &&
                                                                    (request.Email == null || x.UserInfo.IdNavigation.Email.Contains(request.Email));
            var user = await _unitOfWork.UserRepository.GetPagedReponseAsync(request.PageNumber, request.PageSize,
                                                                             filter : query,
                                                                             includeProperties : "UserInfo,MomInfo");

            response = _mapper.Map <List <MomInfoResponse> >(user);
            var totalCount = await _unitOfWork.UserRepository.CountAsync(query);

            return(new PagedResponse <List <MomInfoResponse> >(response, request.PageNumber, request.PageSize, totalCount));
        }
 public async Task <IActionResult> GetAll([FromQuery] MomInfoRequest request)
 {
     return(Ok(await _momInfoService.GetListMomInfo(request)));
 }