public ActionResult Create(Book book, HttpPostedFileBase strImagePath)
        {
            if (ModelState.IsValid)
            {
                if (strImagePath != null && strImagePath.ContentLength > 0)
                {
                    int lastId = 0;
                    try
                    {
                        lastId = db.Book.ToList().Last().iBookID;
                    }
                    catch { }

                    var pic = (lastId + 1) + ".jpg";
                    var path = System.IO.Path.Combine(
                                           Server.MapPath("~/Content/BookImage"), pic);
                    strImagePath.SaveAs(path);
                    book.strImagePath = pic;
                }
                db.Book.Add(book);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(book);
        }
 public ActionResult Edit(Book book)
 {
     if (ModelState.IsValid)
     {
         db.Entry(book).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.CategoryId = new SelectList(db.Category, "iCategoryID", "strCategoryName", book.iCategoryID);
     return View(book);
 }