// GET: Capacity/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Capacity capacity = _repository.GetRoleById(id); if (capacity == null) { return(HttpNotFound()); } return(View(capacity)); }
public ActionResult Create(TaskTypeViewModel taskTypeViewModel) { if (ModelState.IsValid) { taskTypeViewModel.TaskTypeDetail.Roles = new List <Capacity>(); foreach (var r in taskTypeViewModel.RolesSelected) { Capacity newRole = _repository.GetRoleById(Convert.ToInt16(r)); taskTypeViewModel.TaskTypeDetail.Roles.Add(newRole); } _repository.CreateTaskType(taskTypeViewModel.TaskTypeDetail); return(RedirectToAction("Index")); } return(View(taskTypeViewModel)); }
public ActionResult Create(PersonViewModel personViewModel) { if (ModelState.IsValid) { personViewModel.PersonDetail.Roles = new List <Capacity>(); foreach (var r in personViewModel.RolesSelected) { Capacity newRole = _repository.GetRoleById(Convert.ToInt16(r)); personViewModel.PersonDetail.Roles.Add(newRole); } _repository.CreatePerson(personViewModel.PersonDetail); return(RedirectToAction("Index")); } return(View(personViewModel)); }