Example #1
0
 public ActionResult Create()
 {
     try
     {
         var identity   = (LoginIdentity)Thread.CurrentPrincipal.Identity;
         var serializer = new JavaScriptSerializer()
         {
             MaxJsonLength = int.MaxValue
         };
         ViewBag.ItemWithCodeList = serializer.Serialize(_rawSqlService.GetBranchwiseProductCodeStockAll(identity.CompanyId, identity.BranchId));
         ViewBag.ItemList         = serializer.Serialize(_rawSqlService.GetBranchwiseProductStockAll(identity.CompanyId, identity.BranchId));
         SuperShopPurchaseViewModel vm = new SuperShopPurchaseViewModel
         {
             Id              = _purchaseService.GenerateAutoId(identity.CompanyId, identity.BranchId, "Purchase"),
             PurchaseDate    = DateTime.Now,
             PurchaseDetails = new List <SuperShopPurchaseDetailViewModel>()
         };
         vm.PurchaseDetails.Add(new SuperShopPurchaseDetailViewModel());
         vm.CompanyId = identity.CompanyId;
         vm.BranchId  = identity.BranchId;
         return(View(vm));
     }
     catch (Exception ex)
     {
         return(JavaScript($"ShowResult('{ex.Message}','failure')"));
     }
 }
Example #2
0
 public JavaScriptResult Edit(SuperShopPurchaseViewModel purchaseVm)
 {
     try
     {
         _purchaseService.Update(Mapper.Map <Purchase>(purchaseVm));
         return(JavaScript($"ShowResult('{"Data Updated successfully."}','{"success"}','{"redirect"}','{"/SuperShopPurchase?companyId=" + purchaseVm.CompanyId + "&&branchId=" + purchaseVm.BranchId}')"));
     }
     catch (Exception ex)
     {
         return(JavaScript($"ShowResult('{ex.Message}','failure')"));
     }
 }