Ejemplo n.º 1
0
        public ActionResult AddBook(int?id)
        {
            ViewBag.Books = serviceBooks.GetBooks().ToList();
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            UserView userView = new UserView(service.GetUser(Convert.ToInt32(id)));

            if (userView == null)
            {
                return(HttpNotFound());
            }
            return(View(userView));
        }
Ejemplo n.º 2
0
        // GET: BookViews
        public ActionResult Index(string searchString)
        {
            List <BookView> books   = new List <BookView>();
            List <BookDM>   booksDM = new List <BookDM>();

            ViewBag.CurrentFilter = searchString;
            if (!String.IsNullOrEmpty(searchString))
            {
                booksDM = service.BookSearch(searchString).ToList();
            }
            else
            {
                booksDM = service.GetBooks().ToList();
            }
            foreach (var b in booksDM)
            {
                BookView book = new BookView(b);
                book.Genre = new GenreView(serviceGenres.GetGenre(book.GenreID));
                books.Add(book);
            }
            return(View(books));
        }