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

            return(View(model));
        }
Esempio n. 2
0
        public ActionResult Edit(long id)
        {
            var model = new content_dao().Get_By_Id(id);

            SetListCategory(model.content_category_id);
            return(View(model));
        }
Esempio n. 3
0
        public ActionResult SearchContent(string query, int page = 1, int pagesize = 12)
        {
            var content_dao  = new content_dao();
            int total_record = 0;
            var model        = content_dao.ListContent_By_SearchQuery(ref total_record, query, page, pagesize);

            ViewBag.SearchQuery = query;

            // -- Xu ly phan trang
            ViewBag.Total = total_record;
            ViewBag.Page  = page;

            int MaxPage   = 3;
            int TotalPage = 0;

            TotalPage         = (int)Math.Ceiling(((double)total_record / (double)pagesize));
            ViewBag.TotalPage = TotalPage;
            ViewBag.MaxPage   = MaxPage;
            ViewBag.First     = 1;
            ViewBag.Last      = TotalPage;
            ViewBag.Next      = page + 1;
            ViewBag.Prev      = page - 1;
            // -- // phan trang

            return(View(model));
        }
Esempio n. 4
0
        public ActionResult SearchTag(string TagID, int page = 1, int pagesize = 12)
        {
            var content_dao  = new content_dao();
            var tag_dao      = new tag_dao();
            var result_tag   = tag_dao.CheckTag(TagID);
            int total_record = 0;
            var model        = content_dao.ListContent_By_TagID(ref total_record, TagID, page, pagesize);

            //check tag exist
            ViewBag.SearchTag = result_tag == true?tag_dao.Get_By_Id(TagID).name : "";


            // -- Xu ly phan trang
            ViewBag.Total = total_record;
            ViewBag.Page  = page;

            int MaxPage   = 3;
            int TotalPage = 0;

            TotalPage         = (int)Math.Ceiling(((double)total_record / (double)pagesize));
            ViewBag.TotalPage = TotalPage;
            ViewBag.MaxPage   = MaxPage;
            ViewBag.First     = 1;
            ViewBag.Last      = TotalPage;
            ViewBag.Next      = page + 1;
            ViewBag.Prev      = page - 1;
            // -- // phan trang

            return(View(model));
        }
Esempio n. 5
0
        public JsonResult ChangeTopHot(long id)
        {
            var result = new content_dao().ChangeTopHot(id);

            return(Json(new
            {
                status = result
            }));
        }
Esempio n. 6
0
        public JsonResult IncreaseShareCount(long id)
        {
            var result = new content_dao().IncreaseShareCount(id);

            return(Json(new
            {
                status = result
            }));
        }
Esempio n. 7
0
        public ActionResult Index()
        {
            var content_dao = new content_dao();
            var ad_dao      = new ads_dao();

            var model = content_dao.ListTopNewContent_By_Category(0, 6);

            ViewBag.ListBanner = ad_dao.ListAd_ByPostion("1280x500");
            return(View(model));
        }
Esempio n. 8
0
 public ActionResult DeleteAllChecked(string ids)
 {
     if (ids != "" && ids != null)
     {
         string[] array_id = ids.Split(',');
         var      dao      = new content_dao();
         foreach (var id in array_id)
         {
             dao.Delete_Content(long.Parse(id));
         }
     }
     return(RedirectToAction("Index"));
 }
Esempio n. 9
0
        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));
        }
Esempio n. 10
0
        // GET: Admin/home
        public ActionResult Index()
        {
            var ads_dao     = new ads_dao();
            var content_dao = new content_dao();

            // ViewBag - return List<>
            ViewBag.ListContentTag  = new content_tag_dao().ListTag_NumberContent_Des(10);
            ViewBag.ListContentView = content_dao.ListContent_ViewCount_Des(7);

            ViewBag.ListAdClick = ads_dao.ListAd_ClickCount_Des(10);

            //ViewBag - return 1 value not List<>
            ViewBag.TotalClickAd = ads_dao.Check_TotalClickAd();

            ViewBag.TotalShareContent = content_dao.Check_TotalShareContent();
            ViewBag.TotalViewContent  = content_dao.Check_TotalViewContent();

            return(View());
        }
Esempio n. 11
0
        public ActionResult Edit(content content, int page)
        {
            if (ModelState.IsValid)
            {
                var dao     = new content_dao();
                var session = (UserLogin)Session[CommonConstants.USER_SESSION];
                content.modified_by = session.username;

                var result = dao.Update_Content(content);
                if (result)
                {
                    SetAlert(StaticResources.Resources.Pub_UpdateSucess, "success");
                    return(RedirectToAction("Index", "Content", new { page = page }));
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.UpdateContentFailed);
                }
            }
            SetListCategory(content.content_category_id);
            return(View());
        }
Esempio n. 12
0
        public ActionResult Create(content content)
        {
            if (ModelState.IsValid)
            {
                var dao     = new content_dao();
                var session = (UserLogin)Session[CommonConstants.USER_SESSION];
                content.created_by = session.username;

                bool result = dao.Insert_Content(content);
                if (result)
                {
                    SetAlert(StaticResources.Resources.Pub_InsertSuccess, "success");
                    return(RedirectToAction("Index", "Content"));
                }
                else
                {
                    ModelState.AddModelError("", StaticResources.Resources.InsertContentFailed);
                }
            }
            SetListCategory(content.content_category_id);
            return(View());
        }