public ActionResult Create() { try { var identity = (LoginIdentity)Thread.CurrentPrincipal.Identity; MobileShopPurchaseViewModel vm = new MobileShopPurchaseViewModel { Id = _purchaseService.GenerateAutoId(identity.CompanyId, identity.BranchId, "Purchase"), PurchaseDate = DateTime.Now, PurchaseDetails = new List <MobileShopPurchaseDetailViewModel>() }; vm.PurchaseDetails.Add(new MobileShopPurchaseDetailViewModel()); ViewBag.ItemList = new JavaScriptSerializer().Serialize(_rawSqlService.GetPurchaseImeiList(identity.CompanyId, identity.BranchId)); return(View(vm)); } catch (Exception ex) { return(JavaScript($"ShowResult('{ex.Message}','failure')")); } }