public async Task <ActionResult <List <RepairTicket_PaymentStatusDTO> > > SingleListPaymentStatus([FromBody] RepairTicket_PaymentStatusFilterDTO RepairTicket_PaymentStatusFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } PaymentStatusFilter PaymentStatusFilter = new PaymentStatusFilter(); PaymentStatusFilter.Skip = 0; PaymentStatusFilter.Take = int.MaxValue; PaymentStatusFilter.Take = 20; PaymentStatusFilter.OrderBy = PaymentStatusOrder.Id; PaymentStatusFilter.OrderType = OrderType.ASC; PaymentStatusFilter.Selects = PaymentStatusSelect.ALL; List <PaymentStatus> PaymentStatuses = await PaymentStatusService.List(PaymentStatusFilter); List <RepairTicket_PaymentStatusDTO> RepairTicket_PaymentStatusDTOs = PaymentStatuses .Select(x => new RepairTicket_PaymentStatusDTO(x)).ToList(); return(RepairTicket_PaymentStatusDTOs); }
public async Task <ActionResult <List <OrderReport_PaymentStatusDTO> > > FilterListPaymentStatus([FromBody] OrderReport_PaymentStatusFilterDTO OrderReport_PaymentStatusFilterDTO) { if (UnAuthorization) { return(Forbid()); } if (!ModelState.IsValid) { throw new BindException(ModelState); } PaymentStatusFilter PaymentStatusFilter = new PaymentStatusFilter(); PaymentStatusFilter.Skip = 0; PaymentStatusFilter.Take = 20; PaymentStatusFilter.OrderBy = PaymentStatusOrder.Id; PaymentStatusFilter.OrderType = OrderType.ASC; PaymentStatusFilter.Selects = PaymentStatusSelect.ALL; PaymentStatusFilter.Id = OrderReport_PaymentStatusFilterDTO.Id; PaymentStatusFilter.Name = OrderReport_PaymentStatusFilterDTO.Name; List <PaymentStatus> PaymentStatuses = await PaymentStatusService.List(PaymentStatusFilter); List <OrderReport_PaymentStatusDTO> OrderReport_PaymentStatusDTOs = PaymentStatuses .Select(x => new OrderReport_PaymentStatusDTO(x)).ToList(); return(OrderReport_PaymentStatusDTOs); }
public void Setup() { var builder = new DbContextOptionsBuilder <PaymentContext>(); builder.UseInMemoryDatabase("Payments"); var options = builder.Options; var expensivePaymentGateway = new Mock <IExpensivePaymentGateway>(); var cheapPaymentGateway = new Mock <ICheapPaymentGateway>(); var premiumPaymentService = new Mock <IPremiumPaymentService>(); var controllerLogger = new Mock <ILogger <PaymentController> >(); var paymentServiceLogger = new Mock <ILogger <PaymentService> >(); var paymentStatusServiceLogger = new Mock <ILogger <PaymentStatusService> >(); var paymentContext = new PaymentContext(options); var unitOfwork = new UnitOfWorkBase <PaymentContext>(paymentContext); var paymentStatusService = new PaymentStatusService(unitOfwork, paymentStatusServiceLogger.Object); var paymentService = new PaymentService(paymentStatusService, unitOfwork, paymentServiceLogger.Object, expensivePaymentGateway.Object, cheapPaymentGateway.Object, premiumPaymentService.Object); PaymentController = new PaymentController(paymentService, controllerLogger.Object); }
public PaymentController(PaymentService paymentService, PaymentStatusService paymentStatusService) { _paymentService = paymentService; _paymentStatusService = paymentStatusService; }
/// <summary> /// Retrieves description of payment status /// </summary> /// <param name="Value"></param> /// <returns></returns> public string DisplayPaymentStatus(object Value) { if (Value != null) { if (Value.ToString().Length > 0) { PaymentStatusService serv = new PaymentStatusService(); PaymentStatus ps = serv.GetByPaymentStatusID(int.Parse(Value.ToString())); return ps.PaymentStatusName.ToString(); } } return ""; }