public async Task CancelConfirmationAsync(TestingPersonnelCancelConfrimationSpecDto specDto) { if (specDto == null) { throw new ArgumentNullException(nameof(specDto)); } var invitationId = await _testingPersonnelInvitationsRepository.GetInvitationIdByDateAsync(specDto.Date.Date) .ConfigureAwait(false); if (invitationId == Guid.Empty) { ValidationDictionary .AddModelError("Invitation for date was not found", $"{specDto.Date.ToString(dateFormat, CultureInfo.InvariantCulture)}"); return; } var testingPersonnelId = await _testingPersonnelsRepository.GetTestingPersonnelIdByEmailAsync(specDto.Email) .ConfigureAwait(false); if (testingPersonnelId == Guid.Empty) { ValidationDictionary .AddModelError("Testing personnel with email was not found", $"{specDto.Email}"); return; } await _testingPersonnelConfirmationsRepository .CancelInvitationConfirmationAsync(invitationId, testingPersonnelId, specDto.CanceledByUserId) .ConfigureAwait(false); }
public async Task <TestingPersonnelDto> CreateTestingPersonnelAsync(TestingPersonnelSpecDto specDto) { if (specDto == null) { throw new ArgumentNullException(nameof(specDto)); } var existingTestingPersonnelId = await _testingPersonnelsRepository.GetTestingPersonnelIdByEmailAsync(specDto.Email) .ConfigureAwait(false); if (existingTestingPersonnelId != Guid.Empty) { ValidationDictionary .AddModelError("Testing personnel with this email already exists", $"{specDto.Email}"); return(null); } var testingPersonnel = await AddAsync(specDto) .ConfigureAwait(false); return(testingPersonnel); }