public async Task <IActionResult> EnrollStudent()
        {
            await _busConfig.PublichAsync(Queues.PaymentCollect, new Payment
            {
                StudentId       = 1,
                CourseName      = "Maths",
                Amount          = 2.34,
                TransactionDate = DateTime.Now
            });

            return(NoContent());
        }
        public async Task <IActionResult> EnrollStudent()
        {
            await _busConfig.PublichAsync(nameof(SubmitPayment), new Payment
            {
                StudentId  = 1,
                CourseName = "Maths",
                //Amount = 2.34,
                Amount          = 0,
                TransactionDate = DateTime.Now
            });

            return(NoContent());
        }
        public async Task <Results> Handle(RefundPaymentCommand command)
        {
            var student = await _repository.GetStudentByID(command.StudentId);

            if (student == null)
            {
                return(SetResponse(false, "Un-Registered Student"));
            }

            command.StudentName = student.StudentName;
            await _busConfig.PublichAsync(Queues.Notifications, new Notification
            {
                Message = $"{command.StudentName} amount has been refunded. " +
                          $"Refunded amount: £{command.Amount}"
            });

            return(SetResponse(true));
        }
示例#4
0
        public async Task <Results> Handle(CollectPaymentCommand command)
        {
            var student = await _repository.GetStudentByID(command.StudentId);

            if (student == null)
            {
                return(SetResponse(false, "Un-Registered Student"));
            }

            command.StudentName = student.StudentName;
            await _busConfig.PublichAsync(Queues.Notifications, new Notification
            {
                Message = $"{command.StudentName} is being enrolled in {command.CourseName}. " +
                          $"Fee paid: £{command.Amount}"
            });

            return(SetResponse(true));
        }