public ActionResult Create(AreaCreateViewModel model) { if (ModelState.IsValid) { var input = MapperManager.Map <AreaDto>(model); try { var result = _areaManageService.CreateArea(input); if (result.Id > 0) { return(RedirectToAction( "Item", "Layout", new { id = model.LayoutId })); } } catch (NotUniqueException) { ModelState.AddModelError("NotUnique", LanguageSummary.DescriptionNotUnique); } } return(View(model)); }
public ActionResult Create(AreaCreateViewModel model) { if (this.ModelState.IsValid) { var areaId = this.areas.Add(model.Name, model.Description, model.DepartmentId, model.EmployeeId); return(RedirectToAction("Details", new { id = areaId })); } ViewBag.Departments = GetDepartmentsSelecItemsData(); ViewBag.Employees = GetUsersSelecItemsData(); return(View(model)); }