public ActionResult UpdateDepartment(DepartmentPO updateForm) { ActionResult result = null; if (Session["RoleID"] != null) { if ((int)Session["RoleID"] == 1 || (int)Session["RoleID"] == 2) { if (ModelState.IsValid) { DepartmentDO mappedDataUpdate = Mapper.MapDepartmentPOtoDO(updateForm); DepartmentDataAccessLayer.UpdateDepartment(mappedDataUpdate); result = RedirectToAction("ViewAllDepartment"); } else { result = View(updateForm); } } else { result = RedirectToAction("Index", "Home"); } } else { result = RedirectToAction("Index", "Home"); } return(result); }
public static DepartmentPO MapDepartmentDOtoPO(DepartmentDO frmDepartmentDO) { DepartmentPO toDepartmentPO = new DepartmentPO(); toDepartmentPO.DeptID = frmDepartmentDO.DeptID; toDepartmentPO.DeptName = frmDepartmentDO.DeptName; toDepartmentPO.Description = frmDepartmentDO.Description; toDepartmentPO.DeptHead = frmDepartmentDO.DeptHead; toDepartmentPO.DeptHeadSpecialization = frmDepartmentDO.DeptHeadSpecialization; toDepartmentPO.AlumniCount = frmDepartmentDO.AlumniCount; return(toDepartmentPO); }
public ActionResult ViewAllDepartment() { ActionResult response = null; if (Session["RoleID"] != null) { if ((int)Session["RoleID"] == 1 || (int)Session["RoleID"] == 2 || (int)Session["RoleID"] == 3) { List <DepartmentDO> departmentObjectList = DepartmentDataAccessLayer.ReadDepartment(); List <DepartmentBO> departmentBOList = new List <DepartmentBO>(); foreach (DepartmentDO objectList in departmentObjectList) { DepartmentBO mappedDepartmentBO = Mapper.MapDepartmentDOtoBO(objectList); departmentBOList.Add(mappedDepartmentBO); } List <AlumniBO> alumniBOList = new List <AlumniBO>(); AlumniDAL alumniDataAccess = new AlumniDAL(); List <AlumniDO> alumniDAOList = alumniDataAccess.ReadAlumniRecord(); foreach (AlumniDO objectList in alumniDAOList) { AlumniBO mappedAlumniBO = Mapper.MapAlumniDOtoBO(objectList); alumniBOList.Add(mappedAlumniBO); } List <DepartmentBO> departmentBOListCount = AlumniBusinessLogicLayer.LinkedToAlumniAndDepartment(departmentBOList, alumniBOList); List <DepartmentPO> departmentList = new List <DepartmentPO>(); foreach (DepartmentBO objectList in departmentBOList) { DepartmentPO mappedDepartmentPO = Mapper.MapDepartmentBOtoPO(objectList); departmentList.Add(mappedDepartmentPO); } response = View(departmentList); } else { response = RedirectToAction("Index", "Home"); } } else { response = RedirectToAction("Index", "Home"); } return(response); }
public ActionResult UpdateDepartment(int DeptID) { ActionResult response = null; if (Session["RoleID"] != null) { if ((int)Session["RoleID"] == 1 || (int)Session["RoleID"] == 2) { DepartmentDO mappedDataIDDo = DepartmentDataAccessLayer.ViewDepartmentByID(DeptID); DepartmentPO mappedDataIDPo = Mapper.MapDepartmentDOtoPO(mappedDataIDDo); response = View(mappedDataIDPo); } else { response = RedirectToAction("Index", "Home"); } } else { response = RedirectToAction("Index", "Home"); } return(response); }