public ActionResult Index(int page = 1, int page_size = 10)
        {
            var dao   = new content_category_dao();
            var model = dao.ListAllPaging(page, page_size);

            return(View(model));
        }
        public JsonResult ChangeShowHome(int id)
        {
            var result = new content_category_dao().ChangeShowHome(id);

            return(Json(new
            {
                status = result
            }));
        }
 public ActionResult DeleteAllChecked(string ids)
 {
     if (ids != "" && ids != null)
     {
         string[] array_id = ids.Split(',');
         var      dao      = new content_category_dao();
         foreach (var id in array_id)
         {
             dao.Delete(int.Parse(id));
         }
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult Detail(long ID)
        {
            var content_dao          = new content_dao();
            var content_category_dao = new content_category_dao();

            var model = content_dao.View_DetailContent_By_ID(ID);

            ViewBag.ContentTag  = new tag_dao().ListAllTag_By_ContentID(ID);
            ViewBag.RelatedPost = content_dao.ListTopView_RelatedPost_By_ContentID(ID, 3);

            //advertisement
            var ad_dao = new ads_dao();

            ViewBag.Advertisement_300x250 = ad_dao.GetAdvertisementByType("300x250");
            ViewBag.Advertisement_300x600 = ad_dao.GetAdvertisementByType("300x600");

            return(View(model));
        }
        public ActionResult Edit(content_category cate)
        {
            if (ModelState.IsValid)
            {
                var dao     = new content_category_dao();
                var session = (UserLogin)Session[CommonConstants.USER_SESSION];
                cate.modified_by = session.username;

                var result = dao.Update(cate);
                if (result)
                {
                    SetAlert(StaticResources.Resources.Pub_UpdateSucess, "success");
                    return(RedirectToAction("Index", "ContentCate"));
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.UpdateContentCategoryFailed);
                }
            }
            return(View());
        }
        public void SetListCategory(int?selected_id = null)
        {
            var dao = new content_category_dao();

            ViewData["ContentCate"] = new SelectList(dao.ListAll(), "id", "name", selected_id);
        }
        public ActionResult Edit(int id)
        {
            var model = new content_category_dao().Get_By_Id(id);

            return(View(model));
        }