Esempio n. 1
0
        // GET: Books/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            BookViewModel model;

            try
            {
                Book book = await db.Books.FindAsync(id);

                if (id == null)
                {
                    //return View(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    return(PartialView("ViewPartial", id.ToString()));
                }
                if (book == null)
                {
                    //return HttpNotFound();
                    return(PartialView("ViewPartial", id.ToString()));
                }
                model = BookRelase.DetailsBook(book);
                return(View(model));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Esempio n. 2
0
        public async Task <ActionResult> Details(int?id)
        {
            Book          book;
            BookViewModel model;

            try
            {
                if (id == null)
                {
                    //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
                    return(PartialView("IndexNotFound", id.ToString()));
                }
                book = await db.Books.FindAsync(id);

                if (book == null)
                {
                    //return HttpNotFound();
                    return(PartialView("IndexNotFound", id.ToString()));
                }
                model = BookRelase.DetailsBook(book);
            }
            catch
            {
                return(Content("Error"));
            }
            return(View(model));
        }