public async Task <UserModel> CreateUserAsync(UserModel user, OutboxMessageModel message) { await _connection.StoreAsync(user); if (message != null) { await _connection.StoreAsync(message.ToRavendDb()); } await _connection.SaveChangesAsync(); return(user); }
public async Task <UserModel> UpdateUserAsync(UserModel updatingUser, OutboxMessageModel message) { var currentUser = await GetUserAsync(updatingUser.Id); currentUser.Username = updatingUser.Username; currentUser.Region = updatingUser.Region; currentUser.PhoneNumber = updatingUser.PhoneNumber; currentUser.Email = updatingUser.Email; await _connection.StoreAsync(message.ToRavendDb()); await _connection.SaveChangesAsync(); return(currentUser); }
public async Task DeleteUserAsync(string userId, OutboxMessageModel message) { var user = await GetUserAsyncInternal(userId); if (user == null) { return; } _connection.Delete(user); if (message != null) { await _connection.StoreAsync(message.ToRavendDb()); } await _connection.SaveChangesAsync(); }