public IActionResult Index(Guid courseId, Guid trainingId, BuyBookingViewModel model) { var command = new BuyBookingCommand(new Id <Course>(courseId), model.TrainingDate, model.Email, model.Quantity); var result = _mediator.Command(command); if (result.IsFailure) { ModelState.PopulateValidation(result.Errors); return(View(model)); } return(RedirectToAction("Index", "Course")); }
public IActionResult Index(Guid courseId, Guid trainingId) { var trainingDetails = _mediator.Query(new GetTrainingQuery(courseId, trainingId)); var model = new BuyBookingViewModel { CourseId = courseId, TrainingId = trainingId, TrainingDate = trainingDetails.TrainingDate, CourseName = trainingDetails.CourseName }; return(View(model)); }