public IActionResult Delete(int id) { var cli = ctx.Clients.Find(id); ctx.Remove(cli); ctx.SaveChanges(); return(View(cli)); //return RedirectToAction("index"); }
public async Task Handle(DeleteClient command) { var client = await Clients.FindAsync(command.Id); dbContext.Remove(client); await dbContext.SaveChangesAsync(); await eventBus.Publish(new ClientDeleted(command.Id)); }
public async Task <Unit> Handle(DeleteClient command, CancellationToken cancellationToken = default) { var client = await clients.FindAsync(command.Id); dbContext.Remove(client); await SaveAndPublish(client, cancellationToken); return(Unit.Value); }
public async Task Handle(DeleteClient command, CancellationToken cancellationToken = default(CancellationToken)) { var client = await Clients.FindAsync(command.Id); dbContext.Remove(client); await dbContext.SaveChangesAsync(cancellationToken); await eventBus.Publish(new ClientDeleted(command.Id)); }