コード例 #1
0
        public ActionResult Edit(long id)
        {
            var dao     = new ContentD();
            var content = dao.GetByID(id);

            SetViewBag(content.CategoryID);
            return(View());
        }
コード例 #2
0
        // GET: Admin/Content/


        public ActionResult Index(string searchString, int page = 1, int pageSize = 10)
        {
            var dao   = new ContentD();
            var model = dao.ListAllPaging(searchString, page, pageSize);

            ViewBag.SearchString = searchString;

            return(View(model));
        }
コード例 #3
0
        public JsonResult ChangeStatus(long id)
        {
            var result = new ContentD().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
コード例 #4
0
        public ActionResult Create(Content content)
        {
            if (ModelState.IsValid)
            {
                var  dao = new ContentD();
                long id  = dao.Insert(content);
                if (id > 0)
                {
                    SetAlert("Thêm  tin tức thành công", "success");

                    return(RedirectToAction("Index", "Content"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm Content không thành công");
                }
            }
            SetViewBag(content.CategoryID);
            return(View("Index"));
        }
コード例 #5
0
        public ActionResult Edit(Content content)
        {
            if (ModelState.IsValid)
            {
                var dao = new ContentD();

                var result = dao.Update(content);
                if (result)
                {
                    SetAlert("Cập Nhật tin tức thành công", "success");

                    return(RedirectToAction("Index", "Content"));
                }
                else
                {
                    ModelState.AddModelError("", "Cập Nhật không thành công");
                }
            }
            SetViewBag(content.CategoryID);
            return(View());
        }