private async Task ClearAll(int userId) { var activeAmendments = await _amendmentRepository.GetManyAsync(where : a => a.IsLive); var user = await _userService.GetForToastAsync(userId); foreach (var amendment in activeAmendments.Results) { _amendmentRepository.SetIsLive(false, amendment); await _unitOfWork.SaveChangesAsync(userId); await _clientNotifier.SendToAllAsync(DestinationHub.Amendment, ClientNotifierMethods.AmendmentChange, new { id = amendment.Id, results = new OperationResult(OperationType.GoLive), data = amendment, isLive = false, user }); } var activeAmendmentBodies = await _amendmentBodyRepository.GetManyAsync(where : a => a.IsLive); foreach (var amendmentBody in activeAmendmentBodies.Results) { _amendmentBodyRepository.SetIsLive(false, amendmentBody); var amendment = await _amendmentRepository.GetByIdAsync(amendmentBody.AmendId); await _unitOfWork.SaveChangesAsync(userId); await _clientNotifier.SendToAllAsync(DestinationHub.Amendment, ClientNotifierMethods.AmendmentBodyChange, new { id = amendmentBody.Id, results = new OperationResult(OperationType.GoLive), data = amendmentBody, amendment, isLive = false, user }); } }
public async Task <List <AmendmentBody> > GetByAmentmentId(int amendmentId) { var list = (await _repository.GetManyAsync(where : q => q.AmendId == amendmentId)).Results; return(list); }