public ActionResult Edit([Bind(Include = "Id,Isbn,Title,Author,Page,Publisher,PublicationYear,Available,CategoryId")] Book book) { if (ModelState.IsValid) { if (User.IsInRole("Admin") || User.IsInRole("Librarian")) { try { _repo.Actualize(book); _repo.SaveChanges(); } catch { return(View(book)); } } else { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } } ViewBag.CategoryId = new SelectList(_context.Category, "Id", "Name", book.CategoryId); return(View(book)); }