public async Task <bool> DeleteAsync(int id, int clientId, int userId) { if (!await _permissionManager.HasPermission(clientId, userId, Permission.CanDeleteShift)) { throw new Exception("User has not permission to perform this operation"); } return(await _shiftRepository.DeleteAsync(id)); }
public async Task <ActionResult> Delete(Guid id) { try { var result = shiftRepo.Retrieve().FirstOrDefault(x => x.ShiftID == id); if (result == null) { return(NotFound()); } await shiftRepo.DeleteAsync(id); return(NoContent()); } catch (Exception) { return(BadRequest()); } }