コード例 #1
0
        public ActionResult <PaymentDetailDTO> CreatePayment(PaymentCreateDTO paymentDTO)
        {
            var payment = this.mapper.Map <Payment>(paymentDTO);

            payment = this.paymentRepository.CreatePayment(payment);
            return(this.mapper.Map <PaymentDetailDTO>(payment));
        }
コード例 #2
0
        public async Task <PaymentDTO> PutAsync(PaymentCreateDTO dto)
        {
            this.Logger.LogDebug($"{nameof(PaymentCreateService)} called booking with id = {dto.BookingId}");

            return(this.Mapper.Map <PaymentDTO>(
                       await this.PaymentCreateService.CreateAsync(Mapper.Map <PaymentUpdateModel>(dto))));
        }
コード例 #3
0
        public async Task <ActionResult> Create(PaymentCreateDTO Payment)
        {
            var result = await _PaymentService.Create(Payment);

            return(CreatedAtAction(
                       "GetById",
                       new { id = result.PaymentId },
                       result));
        }
コード例 #4
0
        public bool AddPayment(int bookingId, PaymentTypes paymentType, double amount)
        {
            var payment = new PaymentCreateDTO
            {
                Type   = paymentType,
                Amount = amount
            };

            var resp = Client.PostAsJsonAsync($"api/bookings/{bookingId}/payments", payment).Result;

            return(resp.IsSuccessStatusCode);
        }
コード例 #5
0
        public async Task <PaymentDTO> Create(PaymentCreateDTO model)
        {
            var entry = new Payment
            {
                PaymentId     = model.PaymentId,
                CreditCardId  = model.CreditCardId,
                Description   = model.Description,
                CvcCreditCard = model.CvcCreditCard
            };

            await _context.AddAsync(entry);

            await _context.SaveChangesAsync();

            return(_mapper.Map <PaymentDTO>(entry));
        }
コード例 #6
0
 public IActionResult Pay([FromRoute] int id, [FromBody] PaymentCreateDTO payment)
 {
     _hotelService.CreatePayment(id, payment);
     return(NoContent());
 }