Exemplo n.º 1
0
        public async Task <DeleteGroupResults> DeleteGroupAsync(int departmentGroupId, string currentUserId)
        {
            if (!await _authorizationService.CanUserEditDepartmentGroupAsync(currentUserId, departmentGroupId))
            {
                return(DeleteGroupResults.UnAuthroized);
            }

            await _callsService.ClearGroupForDispatchesAsync(departmentGroupId);

            await _workLogsService.ClearGroupForLogsAsync(departmentGroupId);

            await _unitsService.ClearGroupForUnitsAsync(departmentGroupId);

            await _shiftsService.DeleteShiftGroupsByGroupIdAsync(departmentGroupId);

            await _departmentGroupsService.DeleteGroupByIdAsync(departmentGroupId);

            return(DeleteGroupResults.NoFailure);
        }