public void Update(long id, AwbSenderModel model) { var data = _awbs.Get(id).First(); AwbMapper.Map(model, data); _awbs.Update(id, data); }
public static void Map(AwbSenderModel from, AirWaybillEditData to) { to.Bill = from.Bill; to.ArrivalAirport = from.ArrivalAirport; to.DepartureAirport = from.DepartureAirport; to.DateOfArrival = DateTimeOffset.Parse(from.DateOfArrivalLocalString); to.DateOfDeparture = DateTimeOffset.Parse(from.DateOfDepartureLocalString); to.FlightCost = from.FlightCost; to.TotalCostOfSenderForWeight = from.TotalCostOfSenderForWeight; }
public static AirWaybillEditData GetData(AwbSenderModel model, long senderUserId) { return(new AirWaybillEditData { ArrivalAirport = model.ArrivalAirport, Bill = model.Bill, DepartureAirport = model.DepartureAirport, DateOfArrival = DateTimeOffset.Parse(model.DateOfArrivalLocalString), DateOfDeparture = DateTimeOffset.Parse(model.DateOfDepartureLocalString), GTD = null, AdditionalCost = null, BrokerCost = null, CustomCost = null, FlightCost = model.FlightCost, TotalCostOfSenderForWeight = model.TotalCostOfSenderForWeight, BrokerId = null, SenderUserId = senderUserId }); }
private static void ReadFiles(HttpRequestBase request, AwbSenderModel model) { if (model.PackingFile == null && model.PackingFileName == null) { request.ReadFile("PackingFile", (name, bytes) => { model.PackingFileName = name; model.PackingFile = bytes; }); } if (model.AWBFile == null && model.AWBFileName == null) { request.ReadFile("AWBFile", (name, bytes) => { model.AWBFileName = name; model.AWBFile = bytes; }); } }
public virtual ActionResult Edit(long id, AwbSenderModel model) { try { if (ModelState.IsValid) { _awbUpdateManager.Update(id, model); return(RedirectToAction(MVC.SenderAwb.Edit(id))); } } catch (DublicateException) { ModelState.AddModelError("Bill", Validation.AirWaybillAlreadyExists); } BindBag(id); return(View(model)); }
public virtual ActionResult Create(long?id, AwbSenderModel model) { try { if (ModelState.IsValid) { var airWaybillData = AwbMapper.GetData(model, _identity.Id); _awbManager.Create(id, airWaybillData, _identity.Id); return(RedirectToAction(MVC.AirWaybill.Index())); } } catch (DublicateException) { ModelState.AddModelError("Bill", Validation.AirWaybillAlreadyExists); } BindBag(null); return(View(model)); }
public void Update(long id, AwbSenderModel model) { _manager.Update(id, model); }