public async Task Remove(CommandSoucastRemove cmd) { var remove = db.Soucasti.FirstOrDefault(u => u.SoucastId == cmd.SoucastId); if (remove != null) { var ev = new EventSoucastRemoved() { Generation = remove.Generation + 1, EventId = Guid.NewGuid(), SoucastId = cmd.SoucastId, }; db.Soucasti.Remove(remove); await _handler.PublishEvent(ev, MessageType.SoucastRemoved, ev.EventId, remove.EventGuid, remove.Generation, remove.SoucastId); await db.SaveChangesAsync(); } }
public async Task Delete(CommandSoucastRemove cmd) { await _repository.Remove(cmd); }