コード例 #1
0
 public ActionResult RemoveProduct(string prodId)
 {
     if (Request.Cookies["userName"] != null && Request.Cookies["userName"].Value != null)
     {
         FindProductRepository find = new FindProductRepository();
         ProductsModel         p    = find.FindProductModelByID(Convert.ToInt64(prodId));
         if (p != null)
         {
             UpdateProductState update = new UpdateProductState();
             update.ChangeProductStateToUploaded(p.ID);
         }
     }
     else
     {
         var           list = (List <ProductsModel>)Session["cart"];
         ProductsModel prod = list.Where(x => x.ID == Convert.ToInt64(prodId)).SingleOrDefault();
         Session["cart"] = list.Where(x => x.ID != Convert.ToInt64(prodId)).ToList();
         UpdateProductState update = new UpdateProductState();
         if (prod != null)
         {
             update.ChangeProductStateToUploaded(prod.ID);
         }
     }
     return(View("Cart"));
 }
コード例 #2
0
        // GET: ProductDetails
        public ActionResult MoreDetails(long id)
        {
            FindProductRepository f    = new FindProductRepository();
            FindUserRepository    find = new FindUserRepository();
            ProductsModel         pr   = f.FindProductModelByID(id);

            pr.owner = find.FindUserModelByID(pr.ownerID);
            if (Request.Cookies["userName"] != null && Request.Cookies["userName"].Value != null)
            {
                pr.price = pr.price * Convert.ToDecimal(0.9);
            }
            return(View(pr));
        }