public ActionResult Save(EditShipmentViewModel model, string command) { if (command.ToLower() == "save") { // Save the screen data back to the db and exit adjustDates(model.Shipment, model.TZ); var modelError = ShipmentService.InsertOrUpdateShipment(model.Shipment, CurrentUser, model.LGS); if (modelError.IsError) { prepareEditModel(model, model.Shipment); model.SetErrorOnField(ErrorIcon.Error, modelError.Message, "Shipment_" + modelError.FieldName); return(View("Edit", model)); } else { return(RedirectToAction("Shipments")); } } else { return(RedirectToAction("Shipments")); } }
void prepareEditModel(EditShipmentViewModel model, ShipmentModel shipment) { PrepareViewModel(model, EvolutionResources.bnrAddEditShipment + " - " + EvolutionResources.lblShipment + ": " + model.Shipment.Id.ToString(), shipment.Id, MakeMenuOptionFlags(0, 0, shipment.Id)); model.ShippingMethodList = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.ShippingMethod); model.CarrierVesselList = LookupService.FindCarrierVesselListItemModel(); model.PortList = LookupService.FindPortsListItemModel(); model.SeasonList = LookupService.FindLOVItemsListItemModel(CurrentCompany, LOVName.Season); }
public ActionResult Add() { // Called when the user clicks 'Create' to create a new shipment var model = new EditShipmentViewModel(); model.Shipment = ShipmentService.FindShipmentModel(0, CurrentCompany, true); prepareEditModel(model, model.Shipment); return(View("Edit", model)); }
public ActionResult Edit(int id) { // Called when a user clicks to edit an order var model = new EditShipmentViewModel(); model.Shipment = ShipmentService.FindShipmentModel(id, CurrentCompany, true); prepareEditModel(model, model.Shipment); model.LGS = ShipmentService.LockShipment(model.Shipment); return(View("Edit", model)); }
public ActionResult EditContent(int shipmentId, int contentId) { // Called when a user clicks to edit an order - we // go straight to the lines screen var contentModel = ShipmentService.FindShipmentContentModel(contentId); if (contentModel != null) { return(RedirectToAction("Edit", "Purchasing", new { area = "Purchasing", id = $"{contentModel.PurchaseOrderHeaderId}" })); } else { var model = new EditShipmentViewModel(); model.Shipment = ShipmentService.FindShipmentModel(shipmentId, CurrentCompany, true); prepareEditModel(model, model.Shipment); model.LGS = ShipmentService.LockShipment(model.Shipment); model.SetRecordError("ShipmentContent", contentId, true); return(View("Edit", model)); } }