void ICommandHandler <ChangeCharterparty> .Handle(ChangeCharterparty command) { var spot = this._repository.Get(command.SpotCharterId); spot.ChangeCharterparty(command); this._repository.Save(spot); }
public IActionResult ChangeCharterparty(string id, [FromBody] ChangeCharterparty changeCommand) { if (changeCommand == null) { return(BadRequest(new ArgumentNullException("command"))); } if (!changeCommand.SpotCharterId.Equals(new SpotCharterId(Guid.Parse(id)))) { return(this.BadRequest(new ArgumentException($"Command aggregate id {changeCommand.SpotCharterId} does not match with URI parameter {id}."))); } return(this.ProcessCommand(changeCharterpartyHandler, changeCommand)); }
public void ChangeCharterparty(ChangeCharterparty command) { this.UpdateAggregate(new CharterpartyChanged(this.Id, command.Login, command.Version + 1, command.CharterpartyId, command.CharterpartyName)); }