public ActionResult Delete(int id, FormCollection collection) { try { Ddbdatabase Ddbdatabase = db.Ddbdatabases.Find(id); db.Ddbdatabases.Remove(Ddbdatabase); db.SaveChanges(); } catch (DataException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. return(RedirectToAction("Delete", new { id = id, saveChangesError = true })); } return(RedirectToAction("Index")); }
// GET: Ddbdatabase/Delete/5 public ActionResult Delete(int?id, bool?saveChangesError = false) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } if (saveChangesError.GetValueOrDefault()) { ViewBag.ErrorMessage = "Delete failed. Try again, and if the problem persists see your system administrator."; } Ddbdatabase Ddbdatabase = db.Ddbdatabases.Find(id); if (Ddbdatabase == null) { return(HttpNotFound()); } return(View(Ddbdatabase)); }
public ActionResult Create(Ddbdatabase ddbdatabase) { try { // TODO: Add insert logic here if (ModelState.IsValid) { db.Ddbdatabases.Add(ddbdatabase); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ddbdatabase)); } catch (DataException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator."); return(View(ddbdatabase)); } }