public async Task <IActionResult> POItemDelete(int id) { ADTeam5User user = await _userManager.GetUserAsync(HttpContext.User); List <string> identity = userCheck.checkUserIdentityAsync(user); int userID = user.WorkID; //Viewbag for category dropdown list, need to post back List <Catalogue> categoryList = new List <Catalogue>(); var q = _context.Catalogue.GroupBy(x => new { x.Category }).Select(x => x.FirstOrDefault()); foreach (var item in q) { categoryList.Add(item); } categoryList.Insert(0, new Catalogue { ItemNumber = "0", Category = "---Select Category---" }); ViewBag.ListofCategory = categoryList; List <TempPurchaseOrderDetails> tempPurchaseOrderDetailsList1 = b.GetTempPurchaseOrderDetailsList(); b.DeletePOItem(id, tempPurchaseOrderDetailsList1); List <TempPurchaseOrderDetails> tempPurchaseOrderDetailsList = b.GetTempPurchaseOrderDetailsList(); if (tempPurchaseOrderDetailsList == null) { tempPurchaseOrderDetailsList = new List <TempPurchaseOrderDetails>(); } return(PartialView("_TempPurchaseOrderDetailsList", tempPurchaseOrderDetailsList)); }
public async Task <IActionResult> POItemDelete(string poid, int id) { ADTeam5User user = await _userManager.GetUserAsync(HttpContext.User); List <string> identity = userCheck.checkUserIdentityAsync(user); int userID = user.WorkID; //Viewbag for category dropdown list, need to post back List <Catalogue> categoryList = new List <Catalogue>(); var q = _context.Catalogue.GroupBy(x => new { x.Category }).Select(x => x.FirstOrDefault()); foreach (var item in q) { categoryList.Add(item); } categoryList.Insert(0, new Catalogue { ItemNumber = "0", Category = "---Select Category---" }); ViewBag.ListofCategory = categoryList; List <PurchaseOrderRecordDetails> purchaseOrderDetailsList1 = b.GetPurchaseOrderRecordDetails(poid); b.DeletePOItem(id, purchaseOrderDetailsList1); List <PurchaseOrderRecordDetails> purchaseOrderDetailsList = b.GetPurchaseOrderRecordDetails(poid); //ViewBag for voucher price decimal?amount = b.GetTotalAmountForPO(poid); decimal?GST = Math.Round((decimal)(amount * (decimal?)0.07), 2); ViewBag.Amount = amount; ViewBag.GST = GST; ViewBag.TotalAmount = amount + GST; ViewBag.POStatus = _context.PurchaseOrderRecord.Find(poid).Status; if (purchaseOrderDetailsList.Count == 0) { purchaseOrderDetailsList = new List <PurchaseOrderRecordDetails>(); return(Redirect("/PurchaseOrderRecords")); } else { return(View("Details", purchaseOrderDetailsList)); } }