Ejemplo n.º 1
0
        public ActionResult Make(Guid busId)
        {
            var bus       = _busRepository.GetById(busId);
            var viewModel = MakeViewModelMapper.Map(bus);

            return(View(viewModel));
        }
Ejemplo 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));
        }