コード例 #1
0
 public void OTRequest_Service_GetOTRequestFilterUT01()
 {
     //call action
     listOTRequest = objServices.GetOTRequestFilter(UserID3, groupID1, "CreatedDate", true, null);
     //compare
     Assert.AreEqual(2, listOTRequest.Count());
 }
コード例 #2
0
ファイル: OTRequestController.cs プロジェクト: hanuoc/tenatms
        public async Task <HttpResponseMessage> GetAll(HttpRequestMessage request, string userID, string groupID, string column, bool isDesc, int page, int pageSize, [FromBody] FilterOTRequestModel filter)
        {
            Func <HttpResponseMessage> func = () =>
            {
                if (string.IsNullOrEmpty(userID) || string.IsNullOrEmpty(groupID))
                {
                    return(request.CreateErrorResponse(HttpStatusCode.BadRequest, nameof(userID) + MessageSystem.NoValues + nameof(groupID) + MessageSystem.NoValues));
                }
                var model         = _otrequestService.GetOTRequestFilter(userID, groupID, column, isDesc, filter);
                var responseData  = Mapper.Map <IEnumerable <OTRequest>, IEnumerable <OTRequestViewModel> >(model.Skip((page - 1) * pageSize).Take(pageSize));
                var paginationSet = new PaginationSet <OTRequestViewModel>()
                {
                    Items     = responseData,
                    PageIndex = page,
                    TotalRows = model.Count(),
                    PageSize  = pageSize
                };
                return(request.CreateResponse(HttpStatusCode.OK, paginationSet));
            };

            return(await CreateHttpResponse(request, func));
        }