Example #1
0
 public ActionResult Create(LevelModel model)
 {
     if (!ModelState.IsValid)
     {
         TempData["Message"] = "Level is not valid";
         return(View("Create", model));
     }
     _attmgr.Add(model);
     TempData["Message"] = "Level has been successfully added";
     return(RedirectToAction("Index"));
 }
Example #2
0
 public ActionResult Create(CollegeModel model)
 {
     //model.CreatedBy = User.Identity.GetUserName();
     if (!ModelState.IsValid)
     {
         TempData["Message"] = "College is not valid";
         return(RedirectToAction("Index", model));
     }
     _attmgr.Add(model);
     TempData["Message"] = $"{ model.CollegeName} was successfully added!";
     return(RedirectToAction("Index"));
 }
Example #3
0
 public ActionResult Create(ProgrammeModel model)
 {
     ViewBag.colleges = new SelectList(_attmgr.GetColleges(), "CollegeId", "CollegeName");
     if (!ModelState.IsValid)
     {
         TempData["Message"] = "Program is not valid";
         return(RedirectToAction("Index", model));
     }
     _attmgr.Add(model);
     TempData["Message"] = "Program has been successfully added";
     return(RedirectToAction("Index"));
 }
Example #4
0
        public ActionResult Create(CourseModel model)
        {
            ViewBag.levels     = new SelectList(_attmgr.GetLevels(), "LevelId", "LevelName");
            ViewBag.lecturer   = new SelectList(_attmgr.GetLecturers(), "LecturerId", "FirstName");
            ViewBag.colleges   = new SelectList(_attmgr.GetColleges(), "CollegeId", "CollegeName");
            ViewBag.programmes = new SelectList(_attmgr.GetProgrammeByCollegeId(model.CollegeId), "ProgrammeId", "ProgrammeName");
            if (!ModelState.IsValid)
            {
                TempData["Message"] = "Course is not valid";
                return(View("Create", model));
            }

            _attmgr.Add(model);
            TempData["Message"] = "Course has been successfully added";
            return(RedirectToAction("Index"));
        }