public Task <string> DownLoadInvoiceByUserInvoiceId(string invoiceId, string userId, string userTableName) { OrderSummary orderSummary = _context.OrderSummaries.FromSqlRaw($"select '' as statusname,* from UserOrders.User{userTableName}Orders where id='{invoiceId}' and userId='{userId}'").FirstOrDefault(); if (orderSummary.OrderStatusId != (int)EnumOrderStatus.Delivered) { return(Task.FromResult("Requested order not found.")); } return(Task.FromResult(TemplateGeneratorForInvoice.GetHTMLStringForInvoice(invoiceId, orderSummary))); }
public Task <string> DownLoadInvoiceByVendorInvoiceId(string invoiceId, string userId) { var shop = _context.Shops.Where(x => x.UserId == userId).FirstOrDefault(); OrderSummary orderSummary = _context.OrderSummaries.FromSqlRaw($"select '' as statusname,* from VendorOrder.Vendor{shop.tableName}Orders where id='{invoiceId}' and shopId='{shop.Id}'").FirstOrDefault(); if (orderSummary.OrderStatusId != (int)EnumOrderStatus.Delivered) { return(Task.FromResult("Requested order not found.")); } return(Task.FromResult(TemplateGeneratorForInvoice.GetHTMLStringForInvoice(invoiceId, orderSummary))); }