示例#1
0
 public vmEnrollment()
 {
     Course = new vmCourse();
     Student = new vmStudent();
     Semester = new vmSemester();
     Semesters = new List<Semester>();
     Courses = new List<Course>();
     Students = new Dictionary<int, string>();
 }
示例#2
0
 public vmEnrollment()
 {
     Course    = new vmCourse();
     Student   = new vmStudent();
     Semester  = new vmSemester();
     Semesters = new List <Semester>();
     Courses   = new List <Course>();
     Students  = new Dictionary <int, string>();
 }
 public ActionResult Details(int id)
 {
     using (SemestersManager)
     {
         var disp = Mapper.Map<vmSemester>(SemestersManager.GetSemesterbyID(id));
         if (disp == null)
         {
             disp = new vmSemester();
             ModelState.AddModelError("", "Failed to load details for requested item.");
         }
         return View(disp);
     }
 }
 public ActionResult Create(vmSemester sem)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (SemestersManager)
             {
                 var item = Mapper.Map<Semester>(sem);
                 var success = SemestersManager.AddSemester(item);
                 if (success)
                 {
                     return RedirectToAction("Details", new { id = item.ID });
                 }
                 throw new DataException("Unable to save Semester. Please try again.");
             }
         }
     }
     catch (DataException ex)
     {
         ModelState.AddModelError("", ex.Message);
     }
     return View(sem);
 }
 public ActionResult Create()
 {
     var disp = new vmSemester();
     return View(disp);
 }