Exemplo n.º 1
0
        public ActionResult Confirm(ReviewViewModel inViewModel)
        {
            var request       = ReviewViewModelMapper.Map(inViewModel);
            var bookingNumber = _bookingService.CustomerMake(request);
            var outViewModel  = new CompletedViewModel();

            outViewModel.BookingNumber = bookingNumber;
            return(View("Completed", outViewModel));
        }
Exemplo n.º 2
0
        public ActionResult Review(MakeViewModel inViewModel)
        {
            var request            = MakeViewModelMapper.Map(inViewModel);
            var validationMessages = _bookingService.ValidateCustomerMake(request);

            validationMessages.ForEach(validationMessage => ModelState.AddModelError(validationMessage.Field, validationMessage.Text));

            if (!ModelState.IsValid)
            {
                var bus = _busRepository.GetById(inViewModel.BusId);
                MakeViewModelMapper.Hydrate(inViewModel, bus);
                return(View("Make", inViewModel));
            }

            var booking      = _bookingService.SummarizeCustomerMake(request);
            var outViewModel = ReviewViewModelMapper.Map(booking);

            return(View(outViewModel));
        }