public ActionResult DeleteConfirmed(int id) { ProvidersDB provider = db.ProvidersDB.Find(id); db.ProvidersDB.Remove(provider); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,Name,Address")] ProvidersDB provider) { if (ModelState.IsValid) { db.Entry(provider).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(provider)); }
public ActionResult Create([Bind(Include = "Name,Address")] ProvidersDB provider) { if (ModelState.IsValid) { provider.ID = db.ProvidersDB.ToList().Last().ID + 1; db.ProvidersDB.Add(provider); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(provider)); }
// GET: ProvidersDB/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProvidersDB provider = db.ProvidersDB.Find(id); if (provider == null) { return(HttpNotFound()); } return(View(provider)); }