public IHttpActionResult Delitem(string id) { string[] arr = id.Split('a'); UserInfoProductsDAL dal = new UserInfoProductsDAL(); dal.DeleteProductForUser(Convert.ToInt32(arr[0]), Convert.ToInt32(arr[1])); return(Ok()); }
public ActionResult SaveItemForUser(int productId) { UserInfoProductsDAL dal = new UserInfoProductsDAL(); if (Session["User"] != null) { UserInfoModel user = Session["User"] as UserInfoModel; dal.AddProductForUser(user.Id, productId); return(RedirectToAction("Cart")); } else { return(RedirectToAction("LoginRegister")); } }
public ActionResult Cart() { UserInfoProductsDAL dal = new UserInfoProductsDAL(); List <ProductModel> model = new List <ProductModel>(); if (Session["User"] != null) { UserInfoModel user = Session["User"] as UserInfoModel; model = dal.GetProductsForUser(user.Id); } Session["Cart"] = model; foreach (var product in model) { product.PriceDec = Convert.ToDouble(product.Price); } return(RedirectToAction("Index", new { redirect = false })); }