public ActionResult Edit(tblShip tblship) { if (ModelState.IsValid) { db.Entry(tblship).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tblship)); }
public ActionResult Create(tblShip tblship) { if (ModelState.IsValid) { db.tblShips.Add(tblship); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(tblship)); }
// GET: adminShip/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblShip tblShip = db.tblShips.Find(id); db.tblShips.Remove(tblShip); db.SaveChanges(); return(RedirectToAction("Index")); }
// GET: adminShip/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } tblShip tblShip = db.tblShips.Find(id); if (tblShip == null) { return(HttpNotFound()); } return(View(tblShip)); }