Beispiel #1
0
        public ActionResult OrderPlaced(PersonInfo model)
        {
            model.UserId = Convert.ToInt32(Request.Form["userid"]);
            model.PIId   = Convert.ToInt32(Request.Form["pid"]);
            var db = new FootWearDb();

            db.PersonInfoes.Attach(model);
            db.Entry(model).State = System.Data.EntityState.Modified;
            db.SaveChanges();
            var m = db.Carts.Where(u => u.UserId.Equals(model.UserId)).ToList();

            for (int i = 0; i < m.Count; i++)
            {
                m[i].IsActive = false;
                db.Carts.Attach(m[i]);
                db.Entry(m[i]).State = System.Data.EntityState.Modified;
                db.SaveChanges();
            }
            var products = db.Carts.Where(u => u.UserId.Equals(model.UserId) && u.IsActive == true).ToList();

            if (products.Count == 0)
            {
                TempData["Success"] = "Successfully!";
            }
            else
            {
                TempData["Success"] = "Unsuccessfully!";
            }
            return(View());
        }
Beispiel #2
0
        public ActionResult UpdatePerson(PersonInfo model)
        {
            model.UserId = Convert.ToInt32(Request.Form["userid"]);
            model.PIId   = Convert.ToInt32(Request.Form["pid"]);
            var db = new FootWearDb();

            db.PersonInfoes.Attach(model);
            db.Entry(model).State = System.Data.EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Manage", "Account"));
        }