示例#1
0
 public ActionResult Create([Bind(Include = "CourseName,Description,TeacherId")] Course course)
 {
     if (ModelState.IsValid)
     {
         courseRepo.InsertOrUpdate(course);
         return RedirectToAction("Index");
     }
         var model = new CreateCourseViewModel {
              CourseId = course.CourseId,
              CourseName = course.CourseName,
              Description = course.Description
         };
         return View(model);
 }
示例#2
0
 // GET: Curricula/Edit/5
 public ActionResult Edit(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
         Course course = courseRepo.Find((int) id);
         var model = new CreateCourseViewModel {
              CourseId = (int) id,
              CourseName = course.CourseName,
              Description = course.Description
         };
     if (course == null)
     {
         return HttpNotFound();
     }
     return View(model);
 }
示例#3
0
 // GET: Courses/Create
 public ActionResult Create()
 {
     var model = new CreateCourseViewModel {};
     return View(model);
 }