public ActionResult Edit([Bind(Include = "Id,Email,Address,Phone")] Contact contact)
 {
     if (ModelState.IsValid)
     {
         db.Entry(contact).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(contact));
 }
示例#2
0
 public ActionResult Edit([Bind(Include = "Id,Name")] UserType userType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userType));
 }
示例#3
0
 public ActionResult Edit([Bind(Include = "Id,Title,Image,About")] Blog blog, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         blog.Image           = Comman.WorkWithFile.Upload("~/Uploads/", file);
         db.Entry(blog).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(blog));
 }
 public ActionResult Edit([Bind(Include = "Id,Name,Surname,UserTypeId,Email,Password")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.UserTypeId = new SelectList(db.UserTypes, "Id", "Name", user.UserTypeId);
     return(View(user));
 }
示例#5
0
 public ActionResult Edit([Bind(Include = "Id,Name,Surname,About,Image")] Fermer fermer, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         fermer.Image           = Comman.WorkWithFile.Upload("~/Uploads/", file);
         db.Entry(fermer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(fermer));
 }
示例#6
0
 public ActionResult Edit([Bind(Include = "Id,Name,CategoryId,About,Price,Description,BoxOrNot")] Product product, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         product.Image           = Comman.WorkWithFile.Upload("~/Uploads/", file);
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CategoryId = new SelectList(db.Categories, "Id", "Name", product.CategoryId);
     return(View(product));
 }
 public ActionResult Edit([Bind(Include = "id,Name,Image,Size,ProductID")] BoxContain boxContain, HttpPostedFileBase file)
 {
     if (ModelState.IsValid)
     {
         boxContain.Image           = Comman.WorkWithFile.Upload("~/Uploads", file);
         db.Entry(boxContain).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductID = new SelectList(db.Products, "Id", "Name", boxContain.ProductID);
     return(View(boxContain));
 }