public IActionResult ViewLogs(int unitId) { if (!_authorizationService.CanUserViewUnit(UserId, unitId)) { Unauthorized(); } var model = new ViewLogsView(); model.Unit = _unitsService.GetUnitById(unitId); model.Department = _departmentsService.GetDepartmentById(DepartmentId, false); if (model.Unit == null) { Unauthorized(); } model.Logs = _unitsService.GetLogsForUnit(model.Unit.UnitId); return(View(model)); }