public async Task <IActionResult> GetAllPaymentBook([FromQuery] PaymentBookSearchParameter paymentBookSearchParameter) { var getAllPaymentBookQuery = new GetAllPaymentBookQuery(paymentBookSearchParameter); var result = await mediator.Send(getAllPaymentBookQuery); return(StatusCode((int)result.Code, result.Value)); }
/// <summary> /// Gets all PaymentBook. /// </summary> /// <param name="paymentBookSearchParameter">The PaymentBook Search parameters.</param> /// <returns></returns> //public async Task<List<Paymentbook>> GetAllPaymentBook(PaymentBookSearchParameter paymentBookSearchParameter) //{ // { // var getPaymentBookSearchParams = new object[] // { // new MySqlParameter("@p_Limit", paymentBookSearchParameter.PageSize), // new MySqlParameter("@p_Offset", (paymentBookSearchParameter.PageNumber - 1) * paymentBookSearchParameter.PageSize), // new MySqlParameter("@p_VendorId", paymentBookSearchParameter.VendorId), // new MySqlParameter("@p_PackageType", paymentBookSearchParameter.PackageType), // new MySqlParameter("@p_PaymentType", paymentBookSearchParameter.PaymentType), // new MySqlParameter("@p_PaymentStatus", paymentBookSearchParameter.PaymentStatus), // new MySqlParameter("@p_PaymentMode", paymentBookSearchParameter.PaymentMode), // new MySqlParameter("@p_VendorStatus", paymentBookSearchParameter.VendorStatus), // new MySqlParameter("@p_FinanceApprovalStatus", paymentBookSearchParameter.FinanceApprovalStatus), // new MySqlParameter("@p_BHStatus", paymentBookSearchParameter.BHStatus), // new MySqlParameter("@p_FromDate", paymentBookSearchParameter.FromDate), // new MySqlParameter("@p_ToDate", paymentBookSearchParameter.ToDate) // }; // var paymentBook = await FindAll("CALL SpSearchPaymentBook(@p_Limit,@p_Offset,@p_VendorId,@p_PackageType,@p_PaymentType,@p_PaymentStatus,@p_PaymentMode,@p_VendorStatus,@p_FinanceApprovalStatus,@p_BHStatus,@p_FromDate,@p_ToDate)", getPaymentBookSearchParams).ToListAsync(); // return paymentBook; // } //} public async Task <List <PaymentBookResponse> > GetAllPaymentBook(PaymentBookSearchParameter paymentBookSearchParameter) { var paymentbook = FindByCondition(x => x.Id > 0).ProjectTo <PaymentBookResponse>(mapper.ConfigurationProvider); SearchByWallet(ref paymentbook, paymentBookSearchParameter); FilterByDate(ref paymentbook, paymentBookSearchParameter.FromDate, paymentBookSearchParameter.ToDate); var sortedWallets = sortHelper.ApplySort(paymentbook, paymentBookSearchParameter.OrderBy); var pagedWallets = sortedWallets .Skip((paymentBookSearchParameter.PageNumber - 1) * paymentBookSearchParameter.PageSize) .Take(paymentBookSearchParameter.PageSize); return(await pagedWallets.ToListAsync()); }
private void SearchByWallet(ref IQueryable <PaymentBookResponse> paymentbook, PaymentBookSearchParameter paymentBookSearchParameter) { if (paymentBookSearchParameter.VendorId > 0) { paymentbook = paymentbook.Where(x => x.VendorId.Equals(paymentBookSearchParameter.VendorId)); } if (paymentBookSearchParameter.PackageType > 0) { paymentbook = paymentbook.Where(x => x.PackageType.Equals(paymentBookSearchParameter.PackageType)); } if (paymentBookSearchParameter.PaymentType > 0) { paymentbook = paymentbook.Where(x => x.PaymentType.Equals(paymentBookSearchParameter.PaymentType)); } if (paymentBookSearchParameter.PaymentStatus > 0) { paymentbook = paymentbook.Where(x => x.PaymentStatus.Equals(paymentBookSearchParameter.PaymentStatus)); } if (paymentBookSearchParameter.PaymentMode > 0) { paymentbook = paymentbook.Where(x => x.PaymentMode.Equals(paymentBookSearchParameter.PaymentMode)); } if (paymentBookSearchParameter.VendorStatus > 0) { paymentbook = paymentbook.Where(x => x.VendorStatus.Equals(paymentBookSearchParameter.VendorStatus)); } if (paymentBookSearchParameter.FinanceApprovalStatus > 0) { paymentbook = paymentbook.Where(x => x.FinanceApprovalStatus.Equals(paymentBookSearchParameter.FinanceApprovalStatus)); } if (paymentBookSearchParameter.BHStatus > 0) { paymentbook = paymentbook.Where(x => x.Bhstatus.Equals(paymentBookSearchParameter.BHStatus)); } }
/// <summary> /// Initializes a new instance of the <see cref="GetAllPaymentBookQuery"/> class. /// </summary> /// <param name="paymentBookSearchParameter">The PaymentBook Search parameters.</param> public GetAllPaymentBookQuery(PaymentBookSearchParameter paymentBookSearchParameter) { PaymentBookSearchParameter = paymentBookSearchParameter; }