public void InsertManagerShipmentTypesEdit(ShipmentTypesEditViewModel model) { var item = Mapper.Map <Shipment_Types>(model); m_ConentContext.Shipment_Types.Add(item); m_ConentContext.SaveChanges(); }
public void UpdateManagerShipmentTypesEdit(ShipmentTypesEditViewModel model) { var query = from s in m_ConentContext.Shipment_Types where s.Id == model.Id select s; var item = query.FirstOrDefault(); Mapper.Map(model, item); m_ConentContext.SaveChanges(); }
//GET: Admin/ShipmentManager/Create public ActionResult Create() { var model = new ShipmentTypesEditViewModel { Status = 1 }; this.StatusList(1); this.Pair2List <ShipmentTypesEditViewModel, short, short>(ShipmentListProvider.GetMethodList(), m => m.PricingMethod, null); return(View(model)); }
public ActionResult Edit(ShipmentTypesEditViewModel model) { if (ModelState.IsValid) { try { m_shipmentWorker.UpdateManagerShipmentTypesEdit(model); return(RedirectToAction("Index")); } catch (Exception ex) { ModelState.AddModelError("General", ex.Message); } } this.StatusList(model.Status); this.Pair2List <ShipmentTypesEditViewModel, short, short>(ShipmentListProvider.GetMethodList(), m => m.PricingMethod, model.PricingMethod.ToString()); return(View(model)); }