public ActionResult Reservation(int id) { var book = bookOperations.FindById(id); var userId = User.Identity.GetUserId(); try { userOperations.Booking(book, userId); book.UserId = userId; db.SaveChanges(); } catch (Exception ex) { Console.WriteLine(ex.Message); return(View("Index")); } return(RedirectToAction("Index")); }