Example #1
0
        public ActionResult _SelectAvailableStock(int id)
        {
            var selForInvVM = new SelectStockForInvoiceVM
            {
                StockInvoiceId = id,
                SelectedStock  = AutoMapperSetup.MapList <Stock, SelectableStockVM>(_stockInvSvc.GetSelectableStock()).ToList()
            };

            Session["_availableForStock"] = selForInvVM.SelectedStock;
            return(PartialView(selForInvVM));
        }
 public ActionResult _SelectAvailableStock(SelectStockForInvoiceVM mStockForInvoiceVm)
 {
     if (ModelState.IsValid)
     {
         var stkInv      = _stockInvSvc.GetInvoice(mStockForInvoiceVm.StockInvoiceId);
         var defaultDuty = _miscService.GetDefaultDutyPercentage();
         foreach (var selectedStockVm in mStockForInvoiceVm.SelectedStock)
         {
             var stk = _stockInvSvc.GetStock(selectedStockVm.StockId);
             stkInv.AddStockToItems(stk, defaultDuty);
         }
         if (ExecuteRepositoryAction(() => { _stockInvSvc.UpdateInvoice(stkInv); _stockInvSvc.CommitChanges(); }))
         {
             return(ReturnJsonFormSuccess());
         }
     }
     return(PartialView(mStockForInvoiceVm));
 }