public ActionResult AddAssociate(CourseAddAssociateViewModel model, Guid id, string returnUrl = null) { var employee = _employeeService.GetEmployeeByBaseId( new Guid(_userManager.GetUserId(User)) ); var owner = _courseService.GetOwner(id); if (employee.Id != owner.Id) { return(RedirectToAction("Profile", "Employee", new { id = employee.BaseId })); } if (ModelState.IsValid) { var associate = _employeeService.GetEmployeeById(new Guid(model.Associate)); var course = _courseService.GetCourseById(id); _employeeService.AddAssociateToCourse(associate, course); return(RedirectToAction("Show", "Course", new { id = course.Id })); } model.AssociateList = new SelectList(_courseService.GetPossibleAssociates(ViewBag.Course), "Id", "FirstName"); return(RedirectToAction("AddAssociate", new { id = id })); }