コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: UnitsController.cs プロジェクト: guyt101z/Core
        public IActionResult Index()
        {
            var model = new UnitsIndexView();

            model.CanUserAddUnit = _limitsService.CanDepartentAddNewUnit(DepartmentId);

            return(View(model));
        }