public void InsertRequestDetail([FromBody] RequestViewModel reqDetail) { if (reqDetail != null) { RequestDAO.InsertRequestDetail(reqDetail); } }
public ActionResult Store(string itemNo, int?requestId, string category) { ViewBag.requestId = requestId; ViewBag.category = category; ViewBag.categoryList = new SelectList(InventoryDAO.getAllCategoryId(), category); // Click add to cart if (itemNo != null) { switch (requestId) { // New request (store in session) case null: { var li = Session["cartItems"] as List <string>; IncreaseStringList(ref li, itemNo); Session["cartItems"] = li; } break; // Existed request (store in database default: { // insert the request detail RequestViewModel rd = new RequestViewModel() { itemNo = itemNo, requestId = Convert.ToInt32(requestId), quantityNeed = 1, status_requestDetail = "unfulfilled" }; int count = RequestDAO.InsertRequestDetail(rd); ViewBag.RequestItemCount = count; } break; } } List <InventoryViewModel> items = null; if (!string.IsNullOrEmpty(category) && category != "0") { items = InventoryDAO.GetInventories(category); } else { items = InventoryDAO.GetInventories(); } return(View(items)); }