示例#1
0
        public ActionResult AddUserToDB(FormCollection fomr)
        {
            using (AdvancedWebDevelopmentEntities1 context = new AdvancedWebDevelopmentEntities1())
            {
                CustomerData customer = new CustomerData();

                customer.Name     = fomr["name"];
                customer.Surname  = fomr["surname"];
                customer.Mail     = fomr["mail"];
                customer.Phone    = fomr["phone"];
                customer.Password = fomr["password"];
                context.CustomerData.Add(customer);
                context.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }
示例#2
0
        public ActionResult Cart()
        {
            List <ProductInfo> productlist = new List <ProductInfo>();

            using (AdvancedWebDevelopmentEntities1 context = new AdvancedWebDevelopmentEntities1())
            {
                foreach (ProductInfo product in context.ProductInfo)
                {
                    if (product.Product_State.ToString() == "OnCart    ")
                    {
                        productlist.Add(product);
                    }
                }
            }
            ViewBag.productlistt = productlist;
            return(View());
        }
示例#3
0
 public ActionResult SignIn(FormCollection fomr)
 {
     using (AdvancedWebDevelopmentEntities1 context = new AdvancedWebDevelopmentEntities1())
     {
         foreach (CustomerData customer in context.CustomerData)
         {
             if (fomr["mail"] == customer.Mail)
             {
                 if (fomr["password"] == customer.Password)
                 {
                     Session["signin"] = "1";
                     Session["UserID"] = customer.ID;
                     break;
                 }
             }
         }
     }
     return(RedirectToAction("Index"));
 }
示例#4
0
        public ActionResult Buy(int id)
        {
            var a = id;

            using (AdvancedWebDevelopmentEntities1 context = new AdvancedWebDevelopmentEntities1())
            {
                //Cart_Items cartitems = new Cart_Items();
                //cartitems.Product_ID = id;
                //context.Cart_Items.Add(cartitems);
                ProductInfo prod = context.ProductInfo.Find(id);
                prod.Buyer_ID      = Int32.Parse(Session["UserID"].ToString());
                prod.Product_State = "OnCart";
                context.SaveChanges();
                //var prd = context.ProductInfo.Find(id);
                //context.ProductInfo.Remove(prd);
                //context.SaveChanges();
            }
            return(RedirectToAction("Index"));
        }