Esempio n. 1
0
        public async Task <ActionResult> CreateCarReservation(CreateCarReservation command)
        {
            CommandResult result;

            if (ModelState.IsValid)
            {
                result = await CommandDispatcher.DispatchAsync(command);

                if (!result.Success)
                {
                    ViewBag.CarTypeList = await QueryDispatcher.DispatchAll <CarTypeViewModel>();

                    ModelState.AddModelError("", $"{result.Message}");
                    return(View());
                }
                return(View("ReservationSuccess"));
            }
            else
            {
                ViewBag.CarTypeList = await QueryDispatcher.DispatchAll <CarTypeViewModel>();

                return(View(command));
            }
        }
Esempio n. 2
0
        //public ActionResult Index()
        //{
        //    return RedirectToAction("CreateCarReservation");
        //}
        public async Task <ActionResult> CreateCarReservation()
        {
            ViewBag.CarTypeList = await QueryDispatcher.DispatchAll <CarTypeViewModel>();

            return(View("CreateCarReservation", new CreateCarReservation()));
        }