void ICommandHandler <ChangeVessel> .Handle(ChangeVessel command) { var spot = this._repository.Get(command.SpotCharterId); spot.ChangeVessel(command); this._repository.Save(spot); }
public IActionResult ChangeVessel(string id, [FromBody] ChangeVessel 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(changeVesselHandler, changeCommand)); }
public void ChangeVessel(ChangeVessel command) { this.UpdateAggregate(new VesselChanged(this.Id, command.Login, command.Version + 1, command.VesselId, command.VesselName)); }