Example #1
0
        public void CanCreateTrackCommandTest()
        {
            var instance = new TrackCommand() {TrackingId = "ZZZ"};

            Assert.IsNotNull(instance);
            Assert.AreEqual(instance.TrackingId, "ZZZ");
        }
        public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            NameValueCollection collection = controllerContext.HttpContext.Request.Form;

            var command = new TrackCommand();
            command.TrackingId = collection["trackingId"];

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

            var command = new TrackCommand();

            command.TrackingId = collection["trackingId"];

            return(command);
        }
        public ActionResult Search([ModelBinder(typeof(TrackCommandBinder))] TrackCommand trackCommand)
        {
            string trackingIdString = trackCommand.TrackingId;

            var   trackingId = new TrackingId(trackingIdString);
            Cargo cargo      = CargoRepository.Find(trackingId);

            CargoTrackingViewAdapter cargoTrackingViewAdapter = null;

            if (cargo != null)
            {
                IList <HandlingEvent> handlingEvents =
                    HandlingEventRepository.LookupHandlingHistoryOfCargo(trackingId)
                    .DistinctEventsByCompletionTime();
                cargoTrackingViewAdapter = new CargoTrackingViewAdapter(cargo, handlingEvents);
            }
            else
            {
                SetMessage(UnknownMessageId);
            }

            return(View(cargoTrackingViewAdapter));
        }