// GET: Detail public ActionResult Index() { string id_raw = Request.QueryString["bookid"]; if (id_raw == null) { id_raw = Session["id"].ToString(); } int id = Int32.Parse(id_raw); Session.Remove("id"); commentDAO cbd = new commentDAO(); List <comment> comments = cbd.getbyBook(id); List <author> authors = new AuthorDAO().getAuthorByBookID(id); categoryDAO cd = new categoryDAO(); BookDAO db = new BookDAO(); int count = comments.Count; dynamic dy = new ExpandoObject(); dy.book = db.getOne(id); ViewData["count"] = count; dy.cates = cd.getAll(); dy.comments = comments; dy.authors = authors; if (Session["user"] != null) { account a = (account)Session["user"]; new historyDAO().addHistory(a.username, id); } return(View(dy)); }
// GET: Default public ActionResult Index() { String id = Request["acid"]; commentDAO ad = new commentDAO(); SendMail sendMailDao = new SendMail(); ad.delete(int.Parse(id)); return(RedirectToAction("Index", "Manage")); }
// GET: Deletecmt public ActionResult Index() { int Id = int.Parse(Request["cmtid"]); commentDAO e = new commentDAO(); e.deletebyUser(Id);; int Idm = int.Parse(Request["bookid"]); Session["id"] = Idm; return(RedirectToAction("Index", "Detail")); }
// GET: Reply public ActionResult Index() { account a = (account)Session["user"]; int Id = int.Parse(Request["cmtid"]); int bId = int.Parse(Request["bookid"]); String cmt = Request["detail"]; commentDAO e = new commentDAO(); e.addReply(a.username, cmt, Id); string w = "Detail?bookid=" + bId; Session["id"] = bId; return(RedirectToAction("Index", "Detail")); }
// GET: Default public ActionResult Index() { String id = Request["acid"]; commentDAO ad = new commentDAO(); SendMail sendMailDao = new SendMail(); string email = new accountDAO().getaccbyUser(id).email; ad.delete(int.Parse(id)); string subject = "Tài khoản của bạn đã bị xóa!"; string content = "Cảm ơn bạn đã đăng ký sử dụng dịch vụ!"; sendMailDao.Send(email, subject, content); return(RedirectToAction("Index", "Manage")); }
// GET: ProfileView public ActionResult Index() { account a = (account)Session["user"]; dynamic dy = new ExpandoObject(); dy.acc = a; categoryDAO cd = new categoryDAO(); dy.cates = cd.getAll(); commentDAO cbd = new commentDAO(); List <comment> co = cbd.getbyUser(a.username); int countcmt = co.Count; ViewData["countcmt"] = countcmt; ViewBag.notifi = Session["noti"]; Session.Remove("noti"); return(View(dy)); }
// GET: NewComment public ActionResult Index() { if (Session["user"] != null) { account a = (account)Session["user"]; int Id = int.Parse(Request["bookid"]); String cmt = Request["comment"]; commentDAO e = new commentDAO(); e.addnewComment(a.username, cmt, Id); string w = "Detail?bookid=" + Id; Session["id"] = Id; return(RedirectToAction("Index", "Detail")); } else { Session["notify"] = "You have not yet login"; return(RedirectToAction("Index", "Login")); } }
// GET: Manage public ActionResult Index() { account a = (account)Session["user"]; if (a != null) { if (a.Role) { BookDAO db = new BookDAO(); accountDAO adb = new accountDAO(); categoryDAO cdb = new categoryDAO(); commentDAO cd = new commentDAO(); AuthorDAO authorDAO = new AuthorDAO(); List <author> authors = authorDAO.getAll(); List <book> books = db.getAll(1000, 1); List <comment> comments = cd.getAll(); List <account> accounts = adb.getAll(); List <category> categories = cdb.getAll(); List <book_categories> bcats = cdb.getAllss(); dynamic dy = new ExpandoObject(); // dynamic - multiple model dy.books = books; dy.cates = categories; dy.bcats = bcats; dy.comments = comments; dy.accounts = accounts; dy.authors = authors; ViewData["countb"] = db.getAll(1000, 1).Count; ViewData["counta"] = accounts.Count; ViewData["countc"] = comments.Count; return(View(dy)); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Login")); } }