Esempio n. 1
0
 public ActionResult CreateBook()
 {
     if ((string)Session["role"] == "admin" || Convert.ToInt32(Session["id"]) == 1)
     {
         ViewBag.Genre = GenreAction.Get_All_Genre();
         return(View());
     }
     else
     {
         return(Redirect("~/Book/ShowBook"));
     }
 }
Esempio n. 2
0
 public ActionResult EditBook(int Id)
 {
     if ((string)Session["role"] == "admin" || (string)Session["role"] == "staff")
     {
         ViewBag.Book  = BookAction.Find_Book(Id);
         ViewBag.Genre = GenreAction.Get_All_Genre();
         return(View());
     }
     else
     {
         return(Redirect("~/Book/ShowBook"));
     }
 }
Esempio n. 3
0
 public ActionResult BookManager()
 {
     if ((string)Session["role"] == "admin" || (string)Session["role"] == "staff")
     {
         using (var db = new DBShop())
         {
             int page_number = db.DbBook.Where(item => item.flag == false).Count();
             ViewBag.PageNumber = (page_number / page_size) + (page_number % page_size == 0 ? 0 : 1);
             ViewBag.Genre      = GenreAction.Get_All_Genre();
             db.Dispose();
         }
         return(View());
     }
     else
     {
         return(Redirect("~/Book/ShowBook"));
     }
 }