public ActionResult Them(TinTuc tt) { SetViewBag1(); SetViewBag(); if (ModelState.IsValid) { var dao = new TinTucDAO(); tt.LuotXem = 0; tt.NgayTao = DateTime.Now; tt.NgaySua = null; long id = dao.Them(tt); if (id > 0) { logger.Info("Thêm mới tin tức " + tt.Id + " thành công!"); SetAlert("Thêm mới tin thành công!", "success"); return(RedirectToAction("Them")); } else { logger.Info("Thêm mới tin tức không thành công!"); SetAlert("Thêm mới không thành công!", "error"); } } return(View()); }
public ActionResult Sua(TinTuc tt) { SetViewBag1(); SetViewBag(); if (ModelState.IsValid) { var dao = new TinTucDAO(); var result = dao.Sua(tt); if (result) { logger.Info("Cập nhật tin tức " + tt.Id + " thành công!"); SetAlert("Sửa tin tức thành công!", "success"); if (Session["returnUrl"] == null) { return(RedirectToAction("Them")); } else { return(Redirect(Session["returnUrl"].ToString())); } } else { logger.Info("Cập nhật tin tức không thành công!"); SetAlert("Sửa không thành công!", "error"); ModelState.AddModelError("", "Sửa không thành công!"); } } return(View()); }
public ActionResult Delete(int id) { var dao = new TinTucDAO(); dao.Delete(id); return(RedirectToAction("Index")); }
public ActionResult Edit(int id) { var dao = new TinTucDAO().ViewDetail(id); return(View(dao)); }
// // GET: /Admin/TinTuc/ public ActionResult Index(int page = 1, int pageSize = 10) { var dao = new TinTucDAO(); var model = dao.ListAllPaging(page, pageSize); return(View(model)); }
// GET: Admin/TinTuc/TinChoDuyet public ActionResult TinChoDuyet(string tukhoa, int page = 1, int pageSize = 20) { var dao = new TinTucDAO(); var model = dao.TinChoDuyet(tukhoa, page, pageSize); ViewBag.TuKhoa = tukhoa; return(View(model)); }
public int changeAn(int id) { var user = ((UserLogin)Session[CommonStants.USER_SESSION]).userName; var dao = new TinTucDAO(); var kq = dao.ChangeStatus(id, user, true); return(kq); }
public JsonResult ThayDoiTrangThai(long id) { var result = new TinTucDAO().ThayDoiTrangThai(id); return(Json(new { trangthai = result })); }
public ActionResult DetailNews(int id) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var tour = new TinTucDAO().ViewDetail(id); return(View(tour)); }
public int changeAnHien(int id) { var user = ((UserLogin)Session[CommonStants.USER_SESSION]).userName; var dao = new TinTucDAO(); var type = dao.GetById(id); var kq = dao.ChangeStatus(id, user, !type.IS_DELETE); return(kq); }
// // GET: /TinTuc/ public ActionResult Index(int page = 1, int pageSize = 6) { var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); var dao = new TinTucDAO(); var model = dao.ListAll(page, pageSize); ViewBag.News = dao.ListAll(page, pageSize); return(View(model)); }
public JsonResult Delete(int id) { var dao = new TinTucDAO(); var line = dao.GetByID(id); string link = Server.MapPath("/Data/Content/" + line.TINTUC_ID + ".cshtml"); dao.DeleteFile(link); bool value = dao.Delete(id); return(Json(value, JsonRequestBehavior.AllowGet)); }
public ActionResult Sua(int id) { SetViewBag1(); SetViewBag(); if (Request["returnUrl"] != null) { Session["returnUrl"] = Request["returnUrl"]; } var tintuc = new TinTucDAO().ViewDetailByID(id); return(View(tintuc)); }
// // GET: /Home/ public ActionResult Index() { var tourDAO = new TourDAO(); var tintucDAO = new TinTucDAO(); ViewBag.NewTour = tourDAO.ListNewTour(4); ViewBag.News = tintucDAO.ListNews(3); ViewBag.TourGanDay = tourDAO.GetTourGanDay(5); var quangcaoDAO = new QuangCaoDAO(); ViewBag.QuangCao = quangcaoDAO.DanhSachQuangCao(); return(View()); }
public ActionResult Create(TinTucModel sp) { var dao = new TinTucDAO(); var tk = dao.GetByTitle(sp.TIEUDE_TINTUC); if (tk != null) { SetAlert("Tin tức đã tồn tại", "fail"); return(RedirectToAction("Index", "TinTuc")); } //string txtContent = ViewBag.GhiChu; var txtContent = Request.Unvalidated.Form.Get("txtContent"); // encode the data sp.CREATEBY = ((UserLogin)Session[CommonStants.USER_SESSION]).userName; sp.CREATEDATE = DateTime.Now; sp.IDTAIKHOAN = ((UserLogin)Session[CommonStants.USER_SESSION]).userID; decimal id = dao.Insert(sp); if (id > 0) { //var LastId = dao.getIDLastChild(); //string exePath = System.AppContext.BaseDirectory + "\\Data\\Content\\" + namenew + ".html"; string exePath = Server.MapPath("\\Data\\Content\\tt" + id + ".cshtml"); FileStream fs = new FileStream(exePath, FileMode.Create); using (StreamWriter sw = new StreamWriter(fs)) { foreach (var s in txtContent) { sw.Write(s); } sw.Flush(); } fs.Close(); string link = "/Data/Content/tt" + id + ".html"; dao.updatenoidung(link, id); SetAlert("Thêm Thành công", "success"); return(RedirectToAction("Index", "TinTuc")); } else { ModelState.AddModelError("", "Thêm không thành công!"); } return(View("Index")); }
// GET: Admin/TinTuc public ActionResult Index() { TinTucDAO dao = new TinTucDAO(); var x = ((UserLogin)Session[CommonStants.USER_SESSION]).userID; var user = new UserDAO().ViewDetail(x); // ViewBag.typeLoai = getTypeUserView(user); getTypeNews(); var result = dao.listTintuc(); //Add a Dummy Row. return(View(result)); }
public string changeImage(long id, string picture) { if (id == null) { return("Mã không tồn tại"); } var t = new TinTucDAO(); var result = t.GetById(id); if (result == null) { return("Mã không tồn tại"); } t.changeImage(id, picture); return(""); }
public ActionResult Create(tblTINTUC tintuc) { if (ModelState.IsValid) { var dao = new TinTucDAO(); long id = dao.Insert(tintuc); if (id > 0) { return(RedirectToAction("Index", "TinTuc")); } else { ModelState.AddModelError("", "Thêm tin tức không thành công"); } } return(View("Create")); }
public ActionResult Edit(tblTINTUC tintuc) { if (ModelState.IsValid) { var dao = new TinTucDAO(); var result = dao.Update(tintuc); if (result) { return(RedirectToAction("Index", "TinTuc")); } else { ModelState.AddModelError("", "Sửa tin không thành công"); } } return(View("Edit")); }
public ActionResult Edit(TINTUC tin) { if (ModelState.IsValid) { var dao = new TinTucDAO(); tin.MODIFILEDBY = ((UserLogin)Session[CommonStants.USER_SESSION]).userName; var id = dao.Update(tin); if (id) { SetAlert("Sửa thành công", "success"); return(RedirectToAction("Index", "tin")); } else { SetAlert("Sửa không thành công", "danger"); ModelState.AddModelError("", "Cập nhật không thành Công!"); } } return(View("Index")); }
public ActionResult Delete(int id) { var dao = new TinTucDAO(); var result = dao.Delete(id); switch (result) { case true: { SetAlert("Xóa tin tức " + id + " thành công!", "success"); logger.Info("Xóa tin tức " + id + " thành công!"); return(RedirectToAction("Index")); } case false: { SetAlert("Xóa tin tức " + id + " không thành công!", "error"); logger.Error("Xóa tin tức " + id + " không thành công!"); return(RedirectToAction("Index")); } } return(View("AllTin")); }
public ActionResult Edit(int id) { var tintuc = new TinTucDAO().ViewDetail(id); return(View(tintuc)); }
public static DataTable gettintucphapluat() { return(TinTucDAO.gettintucphapluat()); }
public static DataTable gettintucdoisong() { return(TinTucDAO.gettintucdoisong()); }
public static DataTable gettintucslide3() { return(TinTucDAO.gettintucslide3()); }
public static DataTable gettintuc(int matin) { return(TinTucDAO.gettintuc(matin)); }
public static DataTable gettintucphobien() { return(TinTucDAO.gettintucphobien()); }