Beispiel #1
0
 public ActionResult EditCourse(int id)
 {
     TrainEditCourseViewData viewData = new TrainEditCourseViewData();
     Course course = (from cs in CQGJ.Course
                      where cs.CourseID == id
                      select cs).First();
     if (Request.RequestType == "POST")
     {
         course.CourseName = GetString("coursename");
         course.CourseTime = GetInt("time");
         course.TeacherName = GetString("teacher");
         course.Remark = GetString("remark");
         CQGJ.SaveChanges();
     }
     viewData.Course = course;
     return View("EditCourse", viewData);
 }
Beispiel #2
0
 public void EditCourse(int id)
 {
     TrainEditCourseViewData viewData = new TrainEditCourseViewData();
     Course course = (from cs in CQGJ.Course
                      where cs.CourseID == id
                      select cs).First();
     if (GetString("coursename") != "")
     {
         course.CourseName = GetString("coursename");
         course.CourseTime = GetInt("time");
         course.TeacherName = GetString("teacher");
         course.Remark = GetString("remark");
         CQGJ.SaveChanges();
     }
     viewData.Course = course;
     RenderView("EditCourse", viewData);
 }