public async Task Remove(CommandUkolRemove cmd) { var remove = db.Ukoly.FirstOrDefault(u => u.UkolId == cmd.UkolId); if (remove != null) { var ev = new EventUkolDeleted() { Generation = remove.Generation + 1, EventId = Guid.NewGuid(), UkolId = cmd.UkolId, }; db.Ukoly.Remove(remove); await _handler.PublishEvent(ev, MessageType.UkolRemoved, ev.EventId, remove.EventGuid, remove.Generation, remove.UkolId); await db.SaveChangesAsync(); } }
public async Task Delete(CommandUkolRemove cmd) { await _repository.Remove(cmd); }