public async Task UpdateCityName(CityUpdatedMessage message) { string updateCityQuery = "Update Places Set CityName = @Name Where CityId = @Id"; await Data.Database .ExecuteSqlCommandAsync(updateCityQuery, new SqlParameter("@Name", message.CityName), new SqlParameter("@Id", message.CityId)); await Data.SaveChangesAsync(); }
public override async Task SaveAsync(City entity, Message[] messages) { var messageData = new CityUpdatedMessage { CityId = entity.Id, CityName = entity.Name }; var message = new Message(messageData); await base.SaveAsync(entity, message); await this.publisher.Publish(messageData); await this.MarkMessageAsPublished(message.Id); }