public ActionResult Create([Bind(Include = "ID,Row,Col,Value,Name,PathOrNot")] First_Floor first_Floor) { HomeController nameExist = new HomeController(); if (nameExist.IsNameExistinF(first_Floor.Row, first_Floor.Col)) { ModelState.AddModelError("Row", "This location already exists."); ModelState.AddModelError("Col", "This location already exists."); } if (string.IsNullOrEmpty(first_Floor.Row.ToString())) { ModelState.AddModelError("Row", "Enter the Row Number"); } if (string.IsNullOrEmpty(first_Floor.Col.ToString())) { ModelState.AddModelError("Col", "Enter the Col Number"); } if (string.IsNullOrEmpty(first_Floor.Value.ToString())) { ModelState.AddModelError("Value", "Enter the Value"); } if (string.IsNullOrEmpty(first_Floor.PathOrNot.ToString())) { ModelState.AddModelError("PathOrNot", "Enter the Value"); } if (ModelState.IsValid) { db.First_Floor.Add(first_Floor); db.SaveChanges(); return(RedirectToAction("ViewAll")); } return(View(first_Floor)); }
public ActionResult Edit([Bind(Include = "ID,Row,Col,Value,Name,PathONot")] First_Floor first_Floor) { if (string.IsNullOrEmpty(first_Floor.Row.ToString())) { ModelState.AddModelError("Row", "Enter the Row Number"); } if (string.IsNullOrEmpty(first_Floor.Col.ToString())) { ModelState.AddModelError("Col", "Enter the Col Number"); } if (string.IsNullOrEmpty(first_Floor.Value.ToString())) { ModelState.AddModelError("Value", "Enter the Value"); } if (string.IsNullOrEmpty(first_Floor.PathOrNot.ToString())) { ModelState.AddModelError("Value", "Enter the Value"); } if (ModelState.IsValid) { db.Entry(first_Floor).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("ViewAll")); } return(View(first_Floor)); }
public ActionResult DeleteConfirmed(int id) { First_Floor first_Floor = db.First_Floor.Find(id); db.First_Floor.Remove(first_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(first_floor) This returns the line of row for selected data in table */ // GET: First_Floor/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } First_Floor first_Floor = db.First_Floor.Find(id); if (first_Floor == null) { return(HttpNotFound()); } return(View(first_Floor)); }