Exemple #1
0
        public ActionResult Detail(int id)
        {
            BOOK book = BookModel.FilterBook(id);

            if (book == null)
            {
                return(HttpNotFound());
            }

            return(View(book));
        }
Exemple #2
0
        public ActionResult Edit(int id)
        {
            initialiseViewBag(id);
            BOOK book = BookModel.FilterBook(id);

            if (book == null)
            {
                return(HttpNotFound());
            }

            return(View(book));
        }
Exemple #3
0
        public ActionResult AddToWishList(int id)
        {
            BOOK book = BookModel.FilterBook(id);

            if (book == null)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
            if (!WishListModel.Exist(id, loginSession.AuthenticatedUser().USERID))
            {
                WishListModel.AddToWishList(id, loginSession.AuthenticatedUser().USERID);
            }

            return(Json(WishListModel.CountWishList(loginSession.AuthenticatedUser().USERID), JsonRequestBehavior.AllowGet));
        }
Exemple #4
0
        public ActionResult DisApproveBook(int bookid)
        {
            BOOK book = BookModel.FilterBook(bookid);

            if (book == null)
            {
                return(HttpNotFound());
            }

            book.STATUS = Constant.DISAPPROVE_TEXT;
            BookModel.UpdateBook(book);

            int pendingApprovalCount = BookModel.GetBooks().Where(query => String.IsNullOrEmpty(query.STATUS)).Count();

            return(Json(pendingApprovalCount, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
 private void initialiseViewBag(int id = 0)
 {
     if (id == 0)
     {
         ViewBag.Authors        = new MultiSelectList(AuthorModel.GetAuthors(), "AUTHORID", "ALIASNAME");
         ViewBag.PRODUCERID     = new SelectList(ProducerModel.GetProducers(), "PRODUCERID", "NAME");
         ViewBag.Categories     = new MultiSelectList(CategoryModel.GetAllCategory(), "CATEGORYID", "NAME");
         ViewBag.GENREID        = new SelectList(GenreModel.GetGenre(), "GENREID", "NAME");
         ViewBag.LANGUAGEID     = new SelectList(LanguageModel.GetLanguages(), "LANGUAGEID", "LANGUAGE1");
         ViewBag.TRANSLATEDFROM = new SelectList(BookModel.getApprovedBooks(), "BOOKID", "NAME");
     }
     else
     {
         BOOK book = BookModel.FilterBook(id);
         ViewBag.Authors        = new MultiSelectList(AuthorModel.GetAuthors(), "AUTHORID", "ALIASNAME");
         ViewBag.PRODUCERID     = new SelectList(ProducerModel.GetProducers(), "PRODUCERID", "NAME", book.PRODUCER);
         ViewBag.Categories     = new MultiSelectList(CategoryModel.GetAllCategory(), "CATEGORYID", "NAME");
         ViewBag.GENREID        = new SelectList(GenreModel.GetGenre(), "GENREID", "NAME", book.GENREID);
         ViewBag.LANGUAGEID     = new SelectList(LanguageModel.GetLanguages(), "LANGUAGEID", "LANGUAGE1", book.LANGUAGEID);
         ViewBag.TRANSLATEDFROM = new SelectList(BookModel.getApprovedBooks(), "BOOKID", "NAME", book.TRANSLATEDFROM);
     }
 }