public IActionResult Index() { var model = new UnitsIndexView(); model.Department = _departmentsService.GetDepartmentById(DepartmentId); model.CanUserAddUnit = _limitsService.CanDepartentAddNewUnit(DepartmentId); model.Groups = _departmentGroupsService.GetAllGroupsForDepartment(DepartmentId); model.Units = _unitsService.GetUnitsForDepartment(DepartmentId); model.States = _unitsService.GetAllLatestStatusForUnitsByDepartmentId(DepartmentId); model.UnitStatuses = _customStateService.GetAllActiveUnitStatesForDepartment(DepartmentId); model.UnitCustomStates = new Dictionary <int, CustomState>(); foreach (var unit in model.Units) { var type = _unitsService.GetUnitTypeByName(DepartmentId, unit.Type); if (type != null && type.CustomStatesId.HasValue) { var customStates = _customStateService.GetCustomSateById(type.CustomStatesId.Value); if (customStates != null) { model.UnitCustomStates.Add(unit.UnitId, customStates); } } } return(View(model)); }
public IActionResult Index() { var model = new UnitsIndexView(); model.CanUserAddUnit = _limitsService.CanDepartentAddNewUnit(DepartmentId); return(View(model)); }