public ActionResult Edit([Bind(Include = "ID,Row,Col,Value,Name,PathOrNot")] Ground_Floor ground_Floor) { if (string.IsNullOrEmpty(ground_Floor.Row.ToString())) { ModelState.AddModelError("Row", "Enter the Row Number"); } if (string.IsNullOrEmpty(ground_Floor.Col.ToString())) { ModelState.AddModelError("Col", "Enter the Col Number"); } if (string.IsNullOrEmpty(ground_Floor.Value.ToString())) { ModelState.AddModelError("Value", "Enter the Value"); } if (string.IsNullOrEmpty(ground_Floor.PathOrNot.ToString())) { ModelState.AddModelError("Value", "Enter the Value"); } if (ModelState.IsValid) { db.Entry(ground_Floor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ViewAll")); } return(View(ground_Floor)); }
public ActionResult DeleteConfirmed(int id) { Ground_Floor ground_Floor = db.Ground_Floor.Find(id); db.Ground_Floor.Remove(ground_Floor); db.SaveChanges(); return(RedirectToAction("ViewAll")); }
/** * This method is run when the admin clicks on 'Detail' while they are logged in as Adminstrator * @param (int? id) This is the first parameter to Details method * @return View(ground_floor) This returns the line of row for selected data in table */ // GET: Ground_Floor/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Ground_Floor ground_Floor = db.Ground_Floor.Find(id); if (ground_Floor == null) { return(HttpNotFound()); } return(View(ground_Floor)); }
public ActionResult Create([Bind(Include = "ID,Row,Col,Value,Name,PathOrNot")] Ground_Floor ground_Floor) { HomeController nameExist = new HomeController(); if (nameExist.IsNameExistinG(ground_Floor.Row, ground_Floor.Col)) { ModelState.AddModelError("Row", "This location already exists."); ModelState.AddModelError("Col", "This location already exists."); } if (string.IsNullOrEmpty(ground_Floor.Row.ToString())) { ModelState.AddModelError("Row", "Enter the Row Number"); } if (string.IsNullOrEmpty(ground_Floor.Col.ToString())) { ModelState.AddModelError("Col", "Enter the Col Number"); } if (string.IsNullOrEmpty(ground_Floor.Value.ToString())) { ModelState.AddModelError("Value", "Enter the Value"); } if (string.IsNullOrEmpty(ground_Floor.PathOrNot.ToString())) { ModelState.AddModelError("Value", "Enter the Value"); } { ModelState.AddModelError("Value", "Enter the Value"); } if (ModelState.IsValid) { db.Ground_Floor.Add(ground_Floor); db.SaveChanges(); return(RedirectToAction("ViewAll")); } return(View(ground_Floor)); }