public void Update(User user) {
     lock (_userList) {
         ValidateExists(user.Id);
         UpdateExisting(user);
         _eventBus.Publish(new UserRecordUpdated(user.Id));
     }
 }
 public void Create(User user) {
     lock (_userList) {
         ValidateDoesntExistYet(user.UserName);
         var userRow = CreateUserRow(user);
         AddToStorage(userRow);
         user.Id = userRow.Id;
         _eventBus.Publish(new UserRecordCreated(userRow.Id));
     }
 }
 UserRow CreateUserRow(User user) {
     return _mapper.DynamicMap<UserRow>(user);
 }
 void UpdateExisting(User user) {
     var existingRecord = _userList[user.Id];
     _mapper.DynamicMap(user, existingRecord);
 }
Example #5
0
 static void ConfirmUserExists(User user) {
     if (user == null)
         throw new UserDoesntExistException();
 }