Esempio n. 1
0
        public async Task <IActionResult> ViewLogs(int unitId)
        {
            if (!await _authorizationService.CanUserViewUnitAsync(UserId, unitId))
            {
                Unauthorized();
            }

            var model = new ViewLogsView();

            model.Unit = await _unitsService.GetUnitByIdAsync(unitId);

            model.Department = await _departmentsService.GetDepartmentByIdAsync(DepartmentId, false);

            if (model.Unit == null)
            {
                Unauthorized();
            }

            model.Logs = await _unitsService.GetLogsForUnitAsync(model.Unit.UnitId);

            return(View(model));
        }