public virtual ActionResult Edit(long id, AwbBrokerModel model) { try { if(ModelState.IsValid) { _awbUpdateManager.Update(id, model); return RedirectToAction(MVC.BrokerAwb.Edit(id)); } var data = _awbRepository.Get(id).First(); BindBag(data); return View(model); } catch(UnexpectedStateException ex) { if(ex.StateId == _stateConfig.CargoIsCustomsClearedStateId) { var data = _awbRepository.Get(id).First(); return View("Message", (object)string.Format(Pages.CantEditAirWaybill, data.Bill)); } throw; } }
public void Update(long id, AwbBrokerModel model) { var data = _awbRepository.Get(id).First(); _gtdHelper.ProcessGtd(data, model.GTD); _manager.Update(id, model); }
public void Update(long id, AwbBrokerModel model) { var data = _awbs.Get(id).First(); if(data.StateId == _config.CargoIsCustomsClearedStateId) { throw new UnexpectedStateException( data.StateId, "Can't update an AWB while it has the state " + _config.CargoIsCustomsClearedStateId.ToString(CultureInfo.InvariantCulture)); } AwbMapper.Map(model, data); _awbs.Update(id, data); }
private static void ReadFiles(HttpRequestBase request, AwbBrokerModel model) { if (model.GTDFile == null && model.GTDFileName == null) request.ReadFile("GTDFile", (name, bytes) => { model.GTDFileName = name; model.GTDFile = bytes; }); if(model.DrawFile == null && model.DrawFileName == null) request.ReadFile("DrawFile", (name, bytes) => { model.DrawFileName = name; model.DrawFile = bytes; }); if (model.GTDAdditionalFile == null && model.GTDAdditionalFileName == null) request.ReadFile("GTDAdditionalFile", (name, bytes) => { model.GTDAdditionalFileName = name; model.GTDAdditionalFile = bytes; }); if (model.PackingFile == null && model.PackingFileName == null) request.ReadFile("PackingFile", (name, bytes) => { model.PackingFileName = name; model.PackingFile = bytes; }); if (model.InvoiceFile == null && model.InvoiceFileName == null) request.ReadFile("InvoiceFile", (name, bytes) => { model.InvoiceFileName = name; model.InvoiceFile = bytes; }); }
public static void Map(AwbBrokerModel from, AirWaybillEditData to) { to.GTD = from.GTD; to.BrokerCost = from.BrokerCost; to.CustomCost = from.CustomCost; }
public void Update(long id, AwbBrokerModel model) { _manager.Update(id, model); }