public ActionResult EditStatus(EditShipViewModel b) { using (CMS_modelContainer context = new CMS_modelContainer()) { var shipView = context.ShipViews.Single(e => e.Ship_Id == b.Ship_Id); shipView.Ship_Id = b.Ship_Id; shipView.Ship_Place = b.Ship_Place; shipView.Ship_Depart = b.Ship_Depart; shipView.Ship_Arrived = b.Ship_Arrived; shipView.Status = b.Status; context.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult EditStatus(int id) { var shipView = new ShipView(); EditShipViewModel esvm = new EditShipViewModel(); using (CMS_modelContainer context = new CMS_modelContainer()) { shipView = context.ShipViews.Where(b => b.Ship_Id == id).FirstOrDefault(); esvm.Ship_Id = shipView.Ship_Id; esvm.Ship_Place = shipView.Ship_Place; esvm.Ship_Depart = shipView.Ship_Depart; esvm.Ship_Arrived = shipView.Ship_Arrived; esvm.Status = shipView.Status; } esvm.listItem = new List <SelectListItem>(); loadList(esvm.listItem); return(View(esvm)); }