// [ValidateAntiForgeryToken] public async Task <ActionResult> Edit([Bind(Include = "ID,BookName,Price,Description,PictureName,PageCount,PublishDate,CountryID,AuthorID")] Book book, HttpPostedFileBase PictureName) { var b = Request.Form["book"]; if (ModelState.IsValid) { if (PictureName != null) { // help.DeletePhoto(book.PictureName); DeletePhoto(book.PictureName); book.PictureName = SavePicture(PictureName); } else { book.PictureName = book.PictureName; } db.Entry(book).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction(NameAction)); } ViewBag.AuthorID = new SelectList(db.Authors, "ID", "FirstName", book.AuthorID); ViewBag.CountryID = new SelectList(db.Countries, "ID", "CountryName", book.CountryID); return(View(book)); }
public async Task <ActionResult> Edit([Bind(Include = "ID,AttributeType")] AttributesType attributesType) { if (ModelState.IsValid) { db.Entry(attributesType).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(attributesType)); }
public async Task <ActionResult> Edit([Bind(Include = "ID,FirstName,LastName,Rating")] Author author) { if (ModelState.IsValid) { db.Entry(author).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(author)); }
public async Task <ActionResult> Edit([Bind(Include = "ID,CountryName,TelKod")] Country country) { if (ModelState.IsValid) { db.Entry(country).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(country)); }