public ActionResult Register(string Email, string First_Name, string Last_Name,
                              string Phone, string Address, string Date_Birth, string Gender, string Password)
 {
     CustomerAction.Create_Customer(Email, First_Name, Last_Name, Address, Phone, Password, Date_Birth, Gender);
     RecordAction.Create_Record(Email, Email + " create account.", DateTime.Now.Date);
     return(Redirect("~/Book/ShowBook"));
 }
 /* Set Role For User*/
 public JsonResult CreateStaff(int Id, string Role)
 {
     CustomerAction.Create_Staff(Id, Role);
     //return Redirect("~/Customer/Index/" + Session["id"]);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " update role " + Role + "  for account " + CustomerAction.Find_Customer(Id).email, DateTime.Now.Date);
     return(Json(JsonRequestBehavior.AllowGet));
 }
 public ActionResult EditCustomer(int Id, string Email, string Password, string First_name, string Last_name, string Address,
                                  string Phone, string Date_Birth, string Gender)
 {
     ViewBag.ID = Id;
     CustomerAction.Edit_Customer(Id, Email, First_name, Last_name, Password, Phone, Date_Birth, Gender, Address);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " update infomation.", DateTime.Now.Date);
     return(Redirect("~/Customer/Index/" + Session["id"]));
 }
 /* DELETE CUSTOMER */
 public ActionResult DeleteCustomer(int Id)
 {
     if (Id != 0)
     {
         CustomerAction.Delete_Customer(Id);
         RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " lock account " + CustomerAction.Find_Customer(Id).email, DateTime.Now.Date);
         return(Redirect("~/Customer/Index/"));
     }
     return(Redirect("~/Customer/Index/"));
 }
 /* RESTORE CUSTOMERS WERE DELETED */
 public ActionResult UnLockCustomer(int Id)
 {
     if (Id != 0)
     {
         CustomerAction.UnLock(Id);
         RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " unlock account " + CustomerAction.Find_Customer(Id).email, DateTime.Now.Date);
         return(Redirect("~/Home/RestoreData"));
     }
     return(Redirect("~/Customer/Index/"));
 }
Beispiel #6
0
        /* ------------------------------------------------------------- */



        /* UPDATE IMAGE BOOK */
        public ActionResult UpdateImg(int Id, HttpPostedFileBase File)
        {
            string path = "";

            if (File.ContentLength > 0)
            {
                string File_Name = Path.GetFileName(File.FileName);
                path = Path.Combine(Server.MapPath("~/UploadFiles"), File_Name);
                File.SaveAs(path);
                BookAction.Update_Img(Id, File_Name);
            }
            RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " change image from " + BookAction.Find_Book(Id).ten_sach, DateTime.Now.Date);
            return(Redirect("~/Book/BookDetail/" + Id));
        }
Beispiel #7
0
        public ActionResult CreateBook(string Ten_Sach, string Tac_Gia, string The_Loai, string Nha_Xuat_Ban, string Mo_Ta, double Gia_Ban, HttpPostedFileBase File)
        {
            Book   book = new Book();
            string path = "";

            if (File.ContentLength > 0)
            {
                string File_Name = Path.GetFileName(File.FileName);
                path = Path.Combine(Server.MapPath("~/UploadFiles"), File_Name);
                File.SaveAs(path);
                BookAction.Create_Book(Ten_Sach, Tac_Gia, The_Loai, Nha_Xuat_Ban, Mo_Ta, Gia_Ban, File_Name);
            }
            RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " create new book.", DateTime.Now.Date);
            return(Redirect("~/Book/CreateBook"));
        }
Beispiel #8
0
 /* DELETE BOOK */
 public ActionResult DeleteBook(int Id)
 {
     BookAction.Delete_Book(Id);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " delete book " + BookAction.Find_Book(Id).ten_sach, DateTime.Now.Date);
     return(Redirect("~/Book/BookManager/" + Session["id"]));
 }
Beispiel #9
0
 public ActionResult EditBook(int Id, string Ten_Sach, string Tac_Gia, string The_Loai, string Nha_Xuat_Ban, string Mo_Ta, double Gia_Ban)
 {
     BookAction.Edit_Book(Id, Ten_Sach, Tac_Gia, The_Loai, Nha_Xuat_Ban, Mo_Ta, Gia_Ban);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " update book " + Ten_Sach, DateTime.Now.Date);
     return(Redirect("~/Book/BookManager/" + Session["id"]));
 }
Beispiel #10
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"));
 }
Beispiel #11
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"]));
 }
Beispiel #12
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"));
 }
Beispiel #13
0
 /* RESTORE BOOKS WERE DELETED */
 public ActionResult Unlock_Book(int Id)
 {
     BookAction.Restore_Book(Id);
     RecordAction.Create_Record(CustomerAction.Find_Customer((int)Session["id"]).email, CustomerAction.Find_Customer((int)Session["id"]).email + " restore book " + BookAction.Find_Book(Id).ten_sach, DateTime.Now.Date);
     return(Redirect("~/Home/RestoreData"));
 }