public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            NameValueCollection collection = controllerContext.HttpContext.Request.Form;

            var command = new RegistrationCommand(collection["originUnlocode"],
                                                  collection["destinationUnlocode"], collection["arrivalDeadline"]);

            return(command);
        }
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            NameValueCollection collection = controllerContext.HttpContext.Request.Form;

            var command = new RegistrationCommand(collection["originUnlocode"],
                                                  collection["destinationUnlocode"], collection["arrivalDeadline"]);

            return command;
        }
Example #3
0
        public ActionResult Register(
            [ModelBinder(typeof(RegistrationCommandBinder))] RegistrationCommand registrationCommand)
        {
            DateTime arrivalDeadlineDateTime = DateTime.ParseExact(registrationCommand.ArrivalDeadline, RegisterDateFormat,
                                                                   CultureInfo.InvariantCulture);

            string trackingId = BookingServiceFacade.BookNewCargo(
                registrationCommand.OriginUnlocode, registrationCommand.DestinationUnlocode, arrivalDeadlineDateTime
                );

            return(RedirectToAction(ShowActionName, new RouteValueDictionary(new { trackingId })));
        }