public override void Handle(CityEvents.Created message) { CityDto dto = this.Load(message.CityId); if (dto != null) throw new Exception("Item with the same Id already created!"); dto = new CityDto(); dto.CityId = message.CityId; this.Save(dto); }
public void When(CityEvents.NameChanged e) { this.Name = e.Name; }
public void When(CityEvents.CountryChanged e) { this.CountryId = e.CountryId; }
public void When(CityEvents.Created e) { this.CityId = e.CityId; }
public override void Handle(CityEvents.NameChanged message) { CityDto dto = this.Load(message.CityId); dto.Name = message.Name; this.Save(dto); }
public override void Handle(CityEvents.CountryChanged message) { CityDto dto = this.Load(message.CityId); dto.CountryId = message.CountryId; this.Save(dto); }
/// <summary> /// whether the city had a specific event in this turn /// </summary> /// <param name="cityEvent">the event</param> /// <returns>true if event occurred, false if not</returns> public bool HadEvent__Turn(CityEvents cityEvent) => (Data->Events & cityEvent) != 0;