public Task HandleAsync(TransporterDeletedEvent evt, CancellationToken ct) { // Delete transporter identityserver; HttpClient client = new HttpClient(); var result = client.PostAsync("https://localhost:5025/user/" + evt.Id + "", null); return(null); }
public async Task <IdResponse> HandleAsync(DeleteTransporterCommand cmd, CancellationToken ct) { if (cmd.Id.Equals(Guid.Empty)) { return(IdResponse.Unsuccessful("Id is empty")); } var transporter = _transporterRepository.GetById(cmd.id); var result = _transporterRepository.DeleteByT(transporter); var user = _context.Users.Find(cmd.id.ToString()); _context.Users.Remove(user); _context.SaveChanges(); var transporterDeletedEvent = new TransporterDeletedEvent { TransporterId = cmd.id }; _eventRouter.EventAsync(transporterDeletedEvent); return(new IdResponse(cmd.Id)); }