Exemplo n.º 1
0
        public ActionResult AddSemester(Tbl_Semester semester)
        {
            if (ModelState.IsValid)
            {
                if (db.Tbl_Semester.Any(u => u.SemesterName == semester.SemesterName))
                {
                    ViewBag.SemesterDuplicate = " Semester already exist";
                    return(View("AddSemester", semester));
                }

                db.Tbl_Semester.Add(semester);
                db.SaveChanges();
                ModelState.Clear();
                ViewBag.Message = semester.SemesterName + " Successfully Add";
            }
            return(View());
        }
 public ActionResult AddSemester(Tbl_Semester tbl)
 {
     _unitOfWork.GetRepositoryInstance <Tbl_Semester>().Add(tbl);
     return(RedirectToAction("Index"));
 }