Esempio n. 1
0
        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));
        }