public virtual async Task <User> UpdateProfile(string userId, string displayName, string forwardingAddress) { var record = await GetProfileEntityGraphForUpdate(userId); if (record == null) { throw Error.NoSuchProfile(userId); } record.DisplayName = displayName; record.ForwardingAddress = forwardingAddress; await context_.SaveChangesAsync(); var profile = record.ToModel(); return(profile); }
public async Task <MaskedEmail> IncrementReceiveCount(string email) { var address = await GetAddressesForUpdate() .SingleOrDefaultAsync(a => a.EmailAddress == email) ; if (address == null) { throw Error.NoSuchMaskedEmailAddress(email); } address.Received++; await context_.SaveChangesAsync(); return(address.ToModel()); }