public ActionResult Remove(int id) { CARSINFO car = context.CARSINFO.Find(id); context.CARSINFO.Remove(car); context.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { CARSINFO c = null; if (id != 0) { c = context.CARSINFO.ToList().FirstOrDefault(x => x.CARId == id); } return(View(c)); }
public ActionResult Edit(CARSINFO c) { if (ModelState.IsValid) { context.CARSINFO.AddOrUpdate(c); context.SaveChanges(); return(RedirectToAction("Index")); } else { return(View(c)); } }
// GET public ActionResult Remove(int?id) { //if (id == null) //{ // return new HttpStatusCodeResult(HttpStatusCode.BadRequest); //} CARSINFO car = context.CARSINFO.Find(id); if (car == null) { return(HttpNotFound()); } return(View(car)); }