Ejemplo n.º 1
0
        public async Task When_AddPayment_Returns_Ok()
        {
            var response = await _service.AddPayment(_cardId, new AddPaymentModel
            {
                Amount = 200,
                Date   = DateTimeOffset.Now
            });

            Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> AddPayment(string id, PaymentsBindingModel model)
        {
            DateTimeRange dateTimeRange = new DateTimeRange(DateTime.Now, model.DueDate);

            PaymentsBindingOutputModel outputModel = new PaymentsBindingOutputModel()
            {
                Id         = model.Id,
                Amount     = model.Amount,
                StudentId  = model.StudentId,
                Title      = model.Title,
                PaymentDue = dateTimeRange
            };

            var result = await _payments.AddPayment(outputModel);

            if (result == null)
            {
                return(NotFound());
            }

            return(RedirectToAction(nameof(Index)));
        }