I am currently working on an application that generates orders in Xamarin forms for both Android and IOS. The customer can place an order, you can see the method of ordering below in the code block. I would like to create a function that displays the customer's order in PDF format. Is there a way from this function to create a new function called "CreatePdfFile" that generates a pdf with the orders that the customer has ordered?
public async Task<string> PlaceOrderAsync()
{
var cn = DependencyService.Get<ISQLite>().GetConnection();
var data = cn.Table<CartItem>().ToList();
var orderId = Guid.NewGuid().ToString();
var uname = Preferences.Get("Username", "Guest");
foreach(var item in data)
{
OrderDetails od = new OrderDetails()
{
OrderId = orderId,
OrderDetailId = Guid.NewGuid().ToString(),
ProductId = item.ProductId,
ProductName = item.ProductName
};
await client.Child("OrderDetails").PostAsync(od);
}
await client.Child("Orders").PostAsync(
new Order()
{
OrderId = orderId,
Username = uname
});
return orderId;
}