/// <summary> /// Updates the ECA system's social email address with the given updated email address. /// </summary> /// <param name="updatedEmailAddress">The updated email address.</param> public void Update(UpdatedEmailAddress updatedEmailAddress) { var emailAddress = Context.EmailAddresses.Find(updatedEmailAddress.Id); ParticipantPersonSevisDTO participant = null; if (emailAddress != null && emailAddress.PersonId.HasValue) { participant = GetParticipantByPersonId((int)emailAddress.PersonId); } List <EmailAddress> existingEmailAddresses = new List <EmailAddress>(); if (emailAddress != null && updatedEmailAddress.IsPrimary) { existingEmailAddresses = CreateGetOtherEmailAddressesQuery(emailAddress).ToList(); } DoUpdate(updatedEmailAddress, emailAddress, existingEmailAddresses, participant); }
private void DoUpdate(UpdatedEmailAddress updatedEmailAddress, EmailAddress modelToUpdate, List <EmailAddress> otherEmailAddresses, ParticipantPersonSevisDTO participant) { Contract.Requires(updatedEmailAddress != null, "The updatedEmailAddress must not be null."); throwIfEmailAddressNotFound(modelToUpdate, updatedEmailAddress.Id); if (participant != null) { throwValidationErrorIfParticipantSevisInfoIsLocked(participant); } modelToUpdate.EmailAddressTypeId = updatedEmailAddress.EmailAddressTypeId; modelToUpdate.Address = updatedEmailAddress.Address; modelToUpdate.IsPrimary = updatedEmailAddress.IsPrimary; updatedEmailAddress.Audit.SetHistory(modelToUpdate); if (updatedEmailAddress.IsPrimary) { otherEmailAddresses.ForEach(x => x.IsPrimary = false); } }
/// <summary> /// Updates the ECA system's email address data with the given updated email address. /// </summary> /// <param name="updatedEmailAddress">The updated email address.</param> public async Task UpdateAsync(UpdatedEmailAddress updatedEmailAddress) { var emailAddress = await Context.EmailAddresses.FindAsync(updatedEmailAddress.Id); ParticipantPersonSevisDTO participant = null; if (emailAddress != null && emailAddress.PersonId.HasValue) { participant = await GetParticipantByPersonIdAsync((int)emailAddress.PersonId); } List <EmailAddress> existingEmailAddresses = new List <EmailAddress>(); if (emailAddress != null && updatedEmailAddress.IsPrimary) { existingEmailAddresses = await CreateGetOtherEmailAddressesQuery(emailAddress).ToListAsync(); } DoUpdate(updatedEmailAddress, emailAddress, existingEmailAddresses, participant); }
/// <summary> /// /// </summary> /// <param name="updatedEmailAddress"></param> /// <returns></returns> public Task UpdateAsync(UpdatedEmailAddress updatedEmailAddress) { Contract.Requires(updatedEmailAddress != null, "The updated email address must not be null."); return(Task.FromResult <object>(null)); }
/// <summary> /// /// </summary> /// <param name="updatedEmailAddress"></param> public void Update(UpdatedEmailAddress updatedEmailAddress) { Contract.Requires(updatedEmailAddress != null, "The updated email address must not be null."); }