public ActionResult Create([Bind(Include = "Id,Instructor,Hall,Duration,Day,Hour,Minute,MaxPeople,Deleted,GymClassId")] StdGymClassTimetable stdGymClassTimetable) { if (ModelState.IsValid) { db.StdGymClassTimetables.Add(stdGymClassTimetable); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClassId = new SelectList(db.GymClasses, "Id", "Name");//the soure of dropdownlist return(View(stdGymClassTimetable)); }
public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StdGymClassTimetable stdGymClassTimetable = db.StdGymClassTimetables.Find(id); if (stdGymClassTimetable == null) { return(HttpNotFound()); } return(View(stdGymClassTimetable)); }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StdGymClassTimetable stdGymClassTimetable = db.StdGymClassTimetables.Find(id); if (stdGymClassTimetable == null) { return(HttpNotFound()); } ViewBag.ClassId = new SelectList(db.GymClasses, "Id", "Name"); //the soure of dropdownlist return(View(stdGymClassTimetable)); }
public ActionResult Delete(string id) { int idInt; try { idInt = Int32.Parse(id); } catch { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } StdGymClassTimetable stdGymClassTimetable = db.StdGymClassTimetables.Find(idInt); if (stdGymClassTimetable != null) { db.StdGymClassTimetables.Remove(stdGymClassTimetable); db.SaveChanges(); } return(null); }