public IActionResult GetEvoucherList([FromQuery] GetEVoucherListingRequest _request) { string APIName = "GetEvoucherList"; var tmp = LoginInformation.UserName; var tmpe = LoginInformation.UserID; log.LogInformation($"{APIName}\r\nStatus:{_request.Status}\r\nPageNum:{_request.PageNumber}\r\nPageSize{_request.PageSize}"); try { var response = repo.EVoucher.GetEvoucherList(_request); Response.Headers.Add("X-Pagination", PageListHelper.GetPagingMetadata(response)); if (response != null && response.Count > 0) { log.LogInformation($"{APIName}\r\n Get List Count :{response.Count}"); return(Ok(new { data = response, totalCount = response.TotalCount, totalPage = response.TotalPages, currentPage = response.CurrentPage, pageSize = response.PageSize, })); } else { log.LogError($"{APIName}\r\nNo Record Found"); return(NotFound(new Error("Not-Found", "No Record Found"))); } } catch (Exception e) { log.LogError($"{APIName}\r\n{e}"); return(StatusCode(500, new Error("internal-error", e.Message))); } }
public IActionResult GetStoreEvoucherList(GetEVoucherListingRequest _request) { string APIName = "GetStoreEvoucherList"; log.LogInformation($"{APIName}\r\nStatus:{_request.Status}\r\nPageNum:{_request.PageNumber}\r\nPageSize{_request.PageSize}"); try { var response = repo.Estore.GetStoreEvoucherList(_request); if (response != null && response.Count > 0) { Response.Headers.Add("X-Pagination", PageListHelper.GetPagingMetadata(response)); log.LogInformation($"{APIName}\r\n Get List Count :{response.Count}"); return(Ok(response)); } else { log.LogError($"{APIName}\r\nNo Record Found"); return(NotFound(new Error("Not-Found", "No Record Found"))); } } catch (Exception e) { log.LogError($"{APIName}\r\n{e}"); return(StatusCode(500, new Error("internal-error", e.Message))); } }
public PagedList <GetEVoucherListingResponse> GetStoreEvoucherList(GetEVoucherListingRequest _request) { var evoucherList = (from e in db_Evoucher.TblEvouchers where (_request.Status == null || e.Status == _request.Status) && e.Status == (int)RecordStatus.Active && e.Quantity > 0 select new GetEVoucherListingResponse { ExpiryDate = e.ExpiryDate, Quantity = e.Quantity, Status = e.Status, //Image = Path.Combine(configuration["BaseURL"], e.ImagePath), SellingPrice = e.SellingPrice, Title = e.Title, VoucherAmount = e.VoucherAmount, VoucherNo = e.VoucherNo } ).AsQueryable(); return(PagedList <GetEVoucherListingResponse> .ToPagedList(evoucherList, _request.PageNumber, _request.PageSize)); }