BookMgnt.Controllers.BookController.Edit C# (CSharp) Method

Edit() private method

private Edit ( [ Include = "ID,Name,Author,Introduce,imagePath,pubYear,CategoriesID")]Bookbook, System.Web.HttpPostedFileBase image_book ) : System.Web.Mvc.ActionResult
Include [
image_book System.Web.HttpPostedFileBase
return System.Web.Mvc.ActionResult
        public ActionResult Edit([Bind(Include = "ID,Name,Author,Introduce,imagePath,pubYear,CategoriesID")] Book book, HttpPostedFileBase image_book)
        {
            if (ModelState.IsValid)
            {
                if (image_book != null && image_book.ContentLength > 0)
                {
                    string pic = System.IO.Path.GetFileName(image_book.FileName);
                    string path = System.IO.Path.Combine(Server.MapPath("~/Content/imageBook"), pic);
                    if (System.IO.File.Exists(path))
                    {
                        int count = 2;
                        while (System.IO.File.Exists(path))
                        {
                            pic = count.ToString() + pic;
                            path = System.IO.Path.Combine(Server.MapPath("~/Content/imageBook"), pic);
                        }
                    }
                    image_book.SaveAs(path);
                    book.imagePath = pic;
                }
                db.Entry(book).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            //ViewBag.CategoriesID = new SelectList(db.Categories, "ID", "Name", book.CategoriesID);
            return View(book);
        }

Same methods

BookController::Edit ( int id ) : System.Web.Mvc.ActionResult