public IActionResult ReprintInvoice(int?id, int?Download) { // Setting Store Info Here int StoreId = ActiveSession.GetActiveSession(HttpContext.Session, HttpContext.Response, "/Identity/Account/Login?ReturnUrl=/Sales/DailySales"); ViewBag.StoreID = StoreId; var vm = aprajitaContext.RegularInvoices.Include(c => c.Customer).Include(c => c.SaleItems).Include(c => c.PaymentDetail). ThenInclude(c => c.CardDetail).Where(c => c.RegularInvoiceId == id && c.StoreId == StoreId).FirstOrDefault(); string fileName = new RegularSaleManager().RePrintManaulInvoice(aprajitaContext, vm, StoreId); if (Download != null && Download == 101) { return(File(fileName, "application/pdf", Path.GetFileName(fileName))); } return(File(fileName, "application/pdf")); }
public ActionResult SaveOrder([FromBody] SaveOrderDTO dTO) /*string name, [FromBody] String address, [FromBody] SaleItemList[] saleItems)*/ { string result = "Error! Order Is Not Complete!"; if (dTO.Name != null && dTO.Address != null && dTO.SaleItems != null) { InvoiceSaveReturn x = new RegularSaleManager().OnInsert(aprajitaContext, dTO, User.Identity.Name, dTO.StoreId); if (x.NoOfRecord <= 0) { result = "Error while saving bill, Kindly try again!"; } else { result = "Invoice is Generated! Kindly print if required"; return(Json(new { x.FileName, result })); } } return(Json(new { FileName = new String("Error"), result })); }