Exemplo 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"));
     }
 }
Exemplo 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"));
     }
 }
Exemplo 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"));
     }
 }
Exemplo n.º 4
0
        /* RESTORE DATA */
        public ActionResult RestoreData()
        {
            if ((string)Session["role"] == "admin")
            {
                using (var db = new DBShop())
                {
                    int page_customer = db.DbCustomer.Where(item => item.flag == true).Count();
                    int page_book     = db.DbBook.Where(item => item.flag == true).Count();
                    db.Dispose();
                    ViewBag.Customer = page_customer / page_size + (page_customer % page_size == 0 ? 0 : 1);
                    ViewBag.Book     = page_book / page_size + (page_book % page_size == 0 ? 0 : 1);
                    ViewBag.Genre    = GenreAction.Restore_Genre();
                }

                return(View());
            }
            else
            {
                return(Redirect("~/Book/ShowBook"));
            }
        }
Exemplo n.º 5
0
 /* Find Genre By ID */
 public JsonResult GetdGenre(int ID)
 {
     return(Json(GenreAction.Find_By_ID(ID), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 6
0
 /* Validation Genre By Name */
 public JsonResult ValidGenre(string Name)
 {
     return(Json(GenreAction.Find_By_Name(Name), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 7
0
 /* RESTORE GENRES WERE DELETED */
 public ActionResult UnlockGenre(int ID)
 {
     GenreAction.Unlock_Genre(ID);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " restorer genre" + GenreAction.Find_By_ID(ID).genre, DateTime.Now.Date);
     return(Redirect("~/Home/RestoreData"));
 }
Exemplo n.º 8
0
 /* DELETE GENRE */
 public ActionResult DeleteGenre(int ID)
 {
     GenreAction.Lock_Genre(ID);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " delete genre" + GenreAction.Find_By_ID(ID).genre, DateTime.Now.Date);
     return(Redirect("~/Book/BookManager/" + Session["id"]));
 }
Exemplo n.º 9
0
 public ActionResult UpdateGenre(int ID, string Name)
 {
     GenreAction.Update_Genre(ID, Name);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " update genre " + Name, DateTime.Now.Date);
     return(Redirect("~/Book/BookManager"));
 }