public ActionResult Edit(Department department)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(department).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(department));
     }
     catch
     {
         ViewBag.M = "Unable to load Edit DepartmentController";
         return(View());
     }
 }
Пример #2
0
 public ActionResult Edit(ClassRoom classroom)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(classroom).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         return(View(classroom));
     }
     catch
     {
         ViewBag.M = "Unable to load Edit ClassroomController";
         return(View());
     }
 }
Пример #3
0
 public ActionResult Edit(Teacher teacher)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(teacher).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.TeacherDeptId = new SelectList(db.Departments, "DepartmentId", "Name", teacher.TeacherDeptId);
         return(View(teacher));
     }
     catch
     {
         ViewBag.M = "Unable to load Edit TeacherController";
         return(View());
     }
 }
 public ActionResult Edit(Course course)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(course).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.CourseDeptId = new SelectList(db.Departments, "DepartmentId", "Name", course.CourseDeptId);
         return(View(course));
     }
     catch
     {
         ViewBag.M = "Unable to load Edit CourseController";
         return(View());
     }
 }
 public ActionResult Edit(TempRoutine temproutine)
 {
     try
     {
         if (ModelState.IsValid)
         {
             if (User.Identity.Name == temproutine.UserName)
             {
                 db.Entry(temproutine).State = EntityState.Modified;
                 db.SaveChanges();
                 return(RedirectToAction("Index"));
             }
             else
             {
                 ViewBag.message             = "You are not the creator of this Routine So You can not Edit It";
                 ViewBag.RoutineCourseId     = new SelectList(db.Courses, "CourseId", "Name", temproutine.RoutineCourseId);
                 ViewBag.RoutineDepartmentId = new SelectList(db.Departments, "DepartmentId", "Name", temproutine.RoutineDepartmentId);
                 ViewBag.RoutineClassroomId  = new SelectList(db.ClassRooms, "ClassRoomId", "RoomNo", temproutine.RoutineClassroomId);
                 ViewBag.RoutineTeacherId    = new SelectList(db.Teachers, "TeacherId", "Name", temproutine.RoutineTeacherId);
                 ViewBag.RoutineSemesterId   = new SelectList(db.Semesters, "SemesterId", "Name", temproutine.RoutineSemesterId);
                 ViewBag.RoutineTypeId       = new SelectList(db.RoutineTypes, "RoutineTypeId", "TypeName", temproutine.RoutineTypeId);
                 return(View(temproutine));
             }
         }
         ViewBag.RoutineCourseId     = new SelectList(db.Courses, "CourseId", "Name", temproutine.RoutineCourseId);
         ViewBag.RoutineDepartmentId = new SelectList(db.Departments, "DepartmentId", "Name", temproutine.RoutineDepartmentId);
         ViewBag.RoutineClassroomId  = new SelectList(db.ClassRooms, "ClassRoomId", "RoomNo", temproutine.RoutineClassroomId);
         ViewBag.RoutineTeacherId    = new SelectList(db.Teachers, "TeacherId", "Name", temproutine.RoutineTeacherId);
         ViewBag.RoutineSemesterId   = new SelectList(db.Semesters, "SemesterId", "Name", temproutine.RoutineSemesterId);
         ViewBag.RoutineTypeId       = new SelectList(db.RoutineTypes, "RoutineTypeId", "TypeName", temproutine.RoutineTypeId);
         return(View(temproutine));
     }
     catch
     {
         ViewBag.M = "Unable to load Edit TempRoutineController";
         return(View());
     }
 }
 public ActionResult Edit(EveRoutine everoutine)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(everoutine).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.RoutineCourseId     = new SelectList(db.Courses, "CourseId", "Name", everoutine.RoutineCourseId);
         ViewBag.RoutineDepartmentId = new SelectList(db.Departments, "DepartmentId", "Name", everoutine.RoutineDepartmentId);
         ViewBag.RoutineClassroomId  = new SelectList(db.ClassRooms, "ClassRoomId", "RoomNo", everoutine.RoutineClassroomId);
         ViewBag.RoutineTeacherId    = new SelectList(db.Teachers, "TeacherId", "Name", everoutine.RoutineTeacherId);
         ViewBag.RoutineSemesterId   = new SelectList(db.Semesters, "SemesterId", "Name", everoutine.RoutineSemesterId);
         ViewBag.RoutineTypeId       = new SelectList(db.RoutineTypes, "RoutineTypeId", "TypeName", everoutine.RoutineTypeId);
         return(View(everoutine));
     }
     catch
     {
         ViewBag.M = "Unable to load Edit EveRoutineController";
         return(View());
     }
 }