Exemplo n.º 1
0
 //
 // GET: /Home/CreateModule
 public ActionResult CreateModule(int id = 0)
 {
     this.logger.Info("Entering: " + System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.FullName + ": " + System.Reflection.MethodBase.GetCurrentMethod().Name + " --> " + User.Identity.Name);
     try {
         if (id != 0) {
             CourseModuleViewModel cmvm = new CourseModuleViewModel();
             cmvm.CourseId = id;
             return View(cmvm);
         }
         else {
             throw new CustomException("Error creating course module.");
         }
     }
     catch (CustomException ce) {
         this.logger.Trace(ce, "Username: "******"Operation could not be completed! Try again.";
         return View("Error");
     }
     catch (Exception ex) {
         this.logger.Trace(ex, "Username: "******"Operation could not be completed!";
         return View("Error");
     }
 }
Exemplo n.º 2
0
        public CourseModuleViewModel GetViewModel(CourseModule courseModule)
        {
            try {
                CourseModuleViewModel cmvm = new CourseModuleViewModel();
                cmvm.ModuleId = courseModule.ModuleId;
                cmvm.ModuleName = courseModule.ModuleName;
                cmvm.PreviousModuleId = courseModule.PreviousModuleId;
                cmvm.Moduledatetime = courseModule.Moduledatetime;
                cmvm.CourseId = courseModule.CourseId;

                return cmvm;
            }
            catch (Exception ex) {
                throw new CustomException(ex.Message);
            }
        }
Exemplo n.º 3
0
        public ActionResult CreateModule(CourseModuleViewModel courseModuleViewModel)
        {
            this.logger.Info("Entering: " + System.Reflection.MethodBase.GetCurrentMethod().ReflectedType.FullName + ": " + System.Reflection.MethodBase.GetCurrentMethod().Name + " --> " + User.Identity.Name);
            try {
                CourseModule cm = new CourseModule();
                cm.Moduledatetime = courseModuleViewModel.Moduledatetime;
                cm.ModuleName = courseModuleViewModel.ModuleName;
                cm.PreviousModuleId = courseModuleViewModel.PreviousModuleId;
                cm.CourseId = courseModuleViewModel.CourseId;
                this.courseManagement.AddModule(cm);

                return RedirectToAction("DisplayCourses");
            }
            catch (CustomException ce) {
                this.logger.Trace(ce, "Username: "******"Operation could not be completed! Try again.";
                return View("Error");
            }
            catch (Exception ex) {
                this.logger.Trace(ex, "Username: "******"Operation could not be completed!";
                return View("Error");
            }
        }