public ActionResult addGenericList(String generic) { ShoppingList sl = Session["ShoppingList"] as ShoppingList; Client Client = Session["User"] as Client; ItemShopping s = new ItemShopping(); s.Brand = generic; s.ShoppingListId = sl.Id; s.Quantity = 1; s.ProductId = null; ItemShoppingService.AddNew(s); return RedirectToAction("NewList", "Home"); }
public ActionResult addProdList(int id) { if (Session["ShoppingList"] != null) { ShoppingList sl = Session["ShoppingList"] as ShoppingList; Client Client = Session["User"] as Client; ItemShopping s = new ItemShopping(); s.ProductId = id; s.Product = ProductService.GetProductById(id); s.ShoppingListId = sl.Id; s.ShoppingList = sl; s.Quantity = 1; ItemShoppingService.AddNew(s); } return RedirectToAction("NewList", "Home"); }
public void Edit(ItemShopping p) { utOfWork.ItemShoppingRepository.Update(p); utOfWork.Commit(); }
public void AddNew(ItemShopping a) { utOfWork.ItemShoppingRepository.Add(a); utOfWork.Commit(); }
public ActionResult NewList(ItemShopping item) { if (Session["User"] != null) { Client Client = Session["User"] as Client; } else { return RedirectToAction("LoginClient", "Home"); } if (Session["ShoppingList"] == null) { ViewBag.Error = "Failed to add list"; return RedirectToAction("Index", "Home"); } if (item.Product.Name != null && item.Product.Name != "") { int i = 0; List<Product> list = ProductService.GetAllProducts().ToList(); foreach (Product p in list) { if (p.Name.ToUpper().Contains(item.Product.Name.ToUpper()) || p.Description.ToUpper().Contains(item.Product.Name.ToUpper())) { ViewData.Add("Prod" + i, p); i++; } } if (i == 0) { ViewBag.Error = "No items found."; } } else { ViewBag.Error = "No items found."; return View(); } return View(); }
public ActionResult NewList() { if (Session["User"] != null) { Client Client = Session["User"] as Client; } else { return RedirectToAction("LoginClient", "Home"); } if (Session["ShoppingList"] != null) { ShoppingList sl = Session["ShoppingList"] as ShoppingList; ItemShopping its = new ItemShopping(); ViewBag.List = sl; return View(); } else { ViewBag.Error = "Failed to add list"; return RedirectToAction("Index", "Home"); } }