示例#1
0
        public ActionResult Edit(Product_Details product_Details)
        {
            product_Details.ProductImages = "http://mvcshopuploadimages.gear.host/Uploads/default.png";

            foreach (string file in Request.Files)
            {
                var postedFile = Request.Files[file];

                var res = UploadImgAsync(postedFile).ToString();
                //product_Details.ProductImages = res;
                var baseAddress = "http://mvcshopuploadimages.gear.host/Uploads/";
                var imgUrl      = Path.Combine(baseAddress, postedFile.FileName);

                product_Details.ProductImages = imgUrl;
            }
            if (ModelState.IsValid)
            {
                db.Entry(product_Details).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            ViewBag.Brand_Id       = new SelectList(db.Brands, "Id", "BrandName", product_Details.Brand_Id);
            ViewBag.ProductType_Id = new SelectList(db.ProductTypes, "Id", "TypeName", product_Details.ProductType_Id);
            return(View(product_Details));
        }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,BrandName")] Brand brand)
 {
     if (ModelState.IsValid)
     {
         db.Entry(brand).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(brand));
 }
 public ActionResult Edit([Bind(Include = "Id,TypeName,ParentTypeId,TypeOrder")] ProductType productType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(productType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(productType));
 }
示例#4
0
        public bool Update_Account(string UserName, string newPassword)
        {
            var account = context.Users.Where(user => user.UserName == UserName).SingleOrDefault();

            if (account != null)
            {
                account.PW = newPassword;

                context.Entry(account).State = EntityState.Modified;
                context.SaveChanges();

                return(true);
            }

            return(false);
        }