//RefundingInvoice public JsonExecuteResult RefundingInvoice(long invoice_id) { try { Invoice invoice = GetInvoice(invoice_id); if (invoice == null) { throw new Exception("You can't refund this invoice"); } if (dataContext.Invoices.Where(I => I.UserInvoices_ID == invoice.UserInvoices_ID).Count() == 1) { return(RefundingUserInvoice(invoice.UserInvoices_ID.GetValueOrDefault(-1))); } dataContext.spInvoice_Refund(invoice_id); } catch (Exception ex) { return(new JsonExecuteResult(JsonExecuteResultTypes.ERROR, ex.Message)); } return(new JsonExecuteResult(JsonExecuteResultTypes.SUCCESS)); }