Example #1
0
 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));
 }
Example #2
0
        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));
        }
Example #3
0
        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));
        }
Example #4
0
        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);
        }