public async Task UpdateWebUser(UpdateWebUser command) { if (command.AggregateId != Id) { throw new InvalidOperationException("The command was not sended to this aggregate root."); } //Console.WriteLine("Updateando evento WebUserUpdated"); await RaiseEventAsync(new WebUserUpdated(Id, command.Username, command)); }
private void btWebUser_Click(object sender, EventArgs e) { try { int index = dgvUsers.SelectedCells[0].RowIndex; User user = _userCollection.Items[index]; UpdateWebUser d = new UpdateWebUser(user); d.Show(); } catch { } }
public Command RunSearcher(Dictionary <string, object> row, WebCommandsController controller) { UpdateWebUser commands = null; Console.WriteLine("Running searcher Update"); commands = new UpdateWebUser(row.GetValueOrDefault("userid").ToString()) { Username = row.GetValueOrDefault("username").ToString() }; /* * Passos a seguir: * buscamos en la otra base de datos el id de nuestra row, si no existe, creamos y enviamos un command de createWebUser. * si existe, comparamos parametro a parametro que cambio hay, una vez encontrado, instanciamos y devolvemos el command */ return(commands); }
public WebUserUpdated(string aggregateId, string username, UpdateWebUser previous) : base(typeof(WebUser).Name, aggregateId, 0, previous) { Id = aggregateId; this.Username = username; }