public ActionResult Create(string id) { try { var identity = (LoginIdentity)Thread.CurrentPrincipal.Identity; var serializer = new JavaScriptSerializer() { MaxJsonLength = int.MaxValue }; ViewBag.ProductList = serializer.Serialize(_rawSqlService.GetBranchwiseProductStockGreaterThanZero(identity.CompanyId, identity.BranchId)); ViewBag.PromotionalDiscountList = serializer.Serialize(_rawSqlService.GetPromotionalPointAndDiscount(DateTime.Today)); ViewBag.ItemList = serializer.Serialize(_rawSqlService.GetBranchwiseProductStockAll(identity.CompanyId, identity.BranchId)); ViewData["SaleDate"] = DateTime.Now.ToString("MM/dd/yyyy hh:mm tt"); ViewData["open"] = 0; var dataSet = new DataSet(); var customers = Mapper.Map <IEnumerable <CustomerViewModel> >(_customerService.GetAll()); var customer = new CustomerViewModel { ACustomers = customers.ToList() }; if (!string.IsNullOrEmpty(id)) { ViewData["open"] = 1; dataSet = _rawSqlService.ReportLevelPrint(id); } SuperShopSaleViewModel vm = new SuperShopSaleViewModel { Id = _saleService.GenerateAutoId(identity.CompanyId, identity.BranchId, "Sale"), SaleDate = DateTime.Now, PaymentType = PaymentType.Cash.ToString(), Customer = customer, Sales = dataSet }; return(View(vm)); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }