public ActionResult Close(tbDataBaseState tbdatabasestate) { int id = (from s in db.tbDataBaseState select s.id).Max(); tbDataBaseState dbstate = db.tbDataBaseState.Find(id); if (dbstate.Is_Closed == false) { tbdatabasestate.Is_Closed = true; } else { tbdatabasestate.Is_Closed = true; } db.tbDataBaseState.Add(tbdatabasestate); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /DataBaseState/ public ActionResult Index() { ViewBag.State = 0; ViewBag.Reason = ""; int id = (from s in db.tbDataBaseState select s.id).Max(); if (id != 0) { tbDataBaseState dbstate = db.tbDataBaseState.Find(id); if (dbstate.Is_Closed == true) { ViewBag.State = 1; } ViewBag.Reason = dbstate.Reason; } return(View()); }