public async Task SendEmailForEpaadAsync(OrganizationSendEmailForEpaadDto dto) { if (dto == null) { throw new ArgumentNullException(nameof(dto)); } var organizationDto = await _organizationsRepository .GetByIdAsync(dto.OrganizationId) .ConfigureAwait(false); if (organizationDto == null) { ValidationDictionary .AddModelError("Organization not found", $"Organization not found."); return; } if (organizationDto.OrganizationTypeId != campOrganizationTypeId && !organizationDto.IsStaticPooling) { ValidationDictionary .AddModelError("Organization type is not a Camp or organization is not with Static Pooling", $"Organization type is not a Camp or organization is not with Static Pooling."); return; } var city = await _citiesRepository .GetCityEpaadDtoAsync(organizationDto.CityId) .ConfigureAwait(false); var parameters = new Dictionary <string, string> { { "organizationName", organizationDto.Name }, { "country", city.CountryShortName }, { "canton", DefaultEpaadOrganizationState }, { "zip", organizationDto.Zip ?? city.ZipCode }, { "city", city.Name }, { "street", organizationDto.Address }, { "email", string.Join(", ", organizationDto.Contacts.Select(c => c.Email)) }, { "numberOfSamples", organizationDto.NumberOfSamples.ToString(CultureInfo.InvariantCulture) }, { "numberOfPools", organizationDto.NumberOfPools != null?organizationDto.NumberOfPools.ToString() : zeroNumberOfPools }, { "activeSince", organizationDto.CreatedOn.ToString("d", CultureInfo.CreateSpecificCulture("de-CH")) }, { "organizationType", organizationTypes[organizationDto.OrganizationType.Id] } }; foreach (var receiver in dto.Receivers) { await _mailSender.SendEmailForEpaadAsync(receiver, parameters).ConfigureAwait(false); } }