public JsonResult DataTable(string search) { int currentEmployeeCourseId = _employeesProvider.GetEmployee(User.Identity.Name).Course.Id; var list = _studentsProvider.GetStudents(currentEmployeeCourseId, search) .Select(student => new ListItemViewModel() { Album = student.Album, Id = student.Id, Name = string.Format("{0} {1}", student.FirstName, student.LastName) }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult Index() { var curremUser = _employeesProvider.GetEmployee(User.Identity.Name); int userDepartmentId = curremUser.Course.Department.Id; ViewBag.IsRoot = curremUser.Root; IEnumerable <int> ids = null; if (curremUser.Root) { ids = _departmentsProvider.GetAllDepartments().Select(n => n.Id); } else { ids = _departmentsProvider.GetAllDepartments().Where(n => n.Id == userDepartmentId).Select(n => n.Id); } return(View(ids)); }
public ActionResult UpdateProfile(UpdateProfileViewModel profile) { if (ModelState.IsValid) { var user = _authenticationService.MembershipService.GetUserProfileByKey(profile.UserId); var employee = _employeesProvider.GetEmployee(profile.UserId); employee.Email = profile.Email; _authenticationService.MembershipService.UpdateUser(profile.UserName, profile.Email, true); _employeeUpdater.Update(employee); if (profile.IsLockedOut == false && user.Membership.IsLockedOut == true) { _authenticationService.MembershipService.UnLockUser(user.UserName, DateTime.Now); } else if (profile.IsLockedOut == true && user.Membership.IsLockedOut == false) { _authenticationService.MembershipService.LockOutUser(user.UserName, DateTime.Now); } } return(RedirectToAction("Manage", new { userId = profile.UserId })); }
public JsonResult DataTable(string search) { IList <Employee> list = null; var currrentEmployee = _employeesProvider.GetEmployee(User.Identity.Name); if (currrentEmployee.Root) { list = _employeesProvider.GetEmployees(search); } else { list = _employeesProvider.GetEmployees(currrentEmployee.Course.Department.Id, search); } var results = list.Select(n => new ListItemViewModel() { Course = n.Course.Name, Id = n.Id, Name = n.FirstName + " " + n.LastName }).ToList(); return(Json(results, JsonRequestBehavior.AllowGet)); }