public ActionResult Create(DeliveryModel model) { if (ModelState.IsValid) { var entity = model.MapTo <Delivery>(); _deliveryService.InsertDelivery(entity); return(RedirectToAction("List")); } return(View(model)); }
public ActionResult Edit(DeliveryModel model) { if (ModelState.IsValid) { var entity = _deliveryService.GetDelivery(model.Id); entity = model.MapTo <DeliveryModel, Delivery>(entity); _deliveryService.UpdateDelivery(entity); return(RedirectToAction("List")); } return(View(model)); }