public async Task Remove(CommandVykazRemove cmd) { var remove = db.Vykazy.FirstOrDefault(u => u.VykazId == cmd.VykazId); if (remove != null) { var ev = new EventVykazDeleted() { Generation = remove.Generation + 1, EventId = Guid.NewGuid(), VykazId = cmd.VykazId, }; db.Vykazy.Remove(remove); await _handler.PublishEvent(ev, MessageType.VykazRemoved, ev.EventId, remove.EventGuid, remove.Generation, remove.VykazId); await db.SaveChangesAsync(); } }
public async Task Delete(CommandVykazRemove cmd) { await _repository.Remove(cmd); }