public async Task CancelPaymentAsync(int orderId) { var invoice = await _context.Invoices .FirstOrDefaultAsync(i => i.OrderId == orderId); if (invoice != null) { _context.Remove(invoice); await _context.SaveChangesAsync(); } }
public async Task <BaseDTO> Handle(DeletePaymentCommand request, CancellationToken cancellationToken) { var data = await _context.Payments.FindAsync(request.Id); if (data != null) { _context.Remove(data); await _context.SaveChangesAsync(); return(new BaseDTO { Message = "Data has been deleted", Success = true }); } else { return(null); } }