Ejemplo n.º 1
0
 public UnitofWork(string connectionString, string migrationAssemblyName)
 {
     _context           = new UniversityContext(connectionString, migrationAssemblyName);
     _departmentsRepo   = new DepartmentsRepo(_context);
     _studentsRepo      = new StudentsRepo(_context);
     _coursesRepo       = new CoursesRepo(_context);
     _instructorRepo    = new InstructorRepo(_context);
     _studentCourseRepo = new StudentCourseRepo(_context);
 }
 public ActionResult GetAllInstructor()
 {
     if (Session["UserId"] != null && Session["Accountid"] != null)
     {
         InstructorRepo Repo = new InstructorRepo();
         ModelState.Clear();
         return(View(Repo.GetAllInstructorRepo()));
     }
     else
     {
         return(RedirectToAction("Index", "Login"));
     }
 }
 public ActionResult DeleteInst(int id)
 {
     if (Session["UserId"] != null && Session["Accountid"] != null)
     {
         try
         {
             InstructorRepo Repo = new InstructorRepo();
             if (Repo.DeleteInstructor(id))
             {
                 ViewBag.SuccessMessage = "Instructor details deleted successfully";
             }
         }
         catch (SqlException)
         {
             ViewBag.duplicatemessage = "One or more reference to this instrcutor is present so couldnt delete this record";
         }
         return(RedirectToAction("GetAllInstructor"));
     }
     else
     {
         return(RedirectToAction("Index", "Login"));
     }
 }
Ejemplo n.º 4
0
        public bool InsertInstructor(string id, string password, InstructorType type)
        {
            InstructorRepo instructorBL = new InstructorRepo();

            return(instructorBL.InsertInstructor(id, password, type));
        }
Ejemplo n.º 5
0
        public InstructorType getType(string username, string password)
        {
            InstructorRepo instructorBL = new InstructorRepo();

            return(instructorBL.RetrieveType(username, password));
        }