예제 #1
0
        public JsonResult GetDetailNews(long id)
        {
            try
            {
                var dbNews = _newsBusiness.GetById(id);
                if (dbNews != null)
                {
                    Common.News viewNews = new Common.News();
                    viewNews.Id              = dbNews.Id;
                    viewNews.NewsGroupId     = dbNews.NewsGroupId;
                    viewNews.Title           = dbNews.Title;
                    viewNews.ImageSource     = dbNews.ImageSource;
                    viewNews.Summary         = dbNews.Summary;
                    viewNews.Descriptions    = dbNews.Descriptions;
                    viewNews.Status          = dbNews.Status;
                    viewNews.isPublic        = dbNews.isPublic;
                    viewNews.TotalView       = dbNews.TotalView;
                    viewNews.AdminIDApproval = dbNews.AdminIDApproval;

                    return(Json(viewNews, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(0));
                }
            }
            catch (Exception)
            {
                //Write log
                throw;
            }
        }
예제 #2
0
        public ActionResult EditNews(long id)
        {
            List <LoadCombo.DropdowNews> listDropdowNews = new List <LoadCombo.DropdowNews>();

            ViewBag.NewsGroupId = _loadCombo.SearchNewsByName(ref listDropdowNews);

            //ListGroup from name of group
            ViewBag.listGroupNewsGroupWithNamme = _loadCombo.InitSelectListItemStatusNewsGroup();

            var record = _newsBusines.GetById(id);

            ViewBag.Tags   = GetTag(id, 2, "");
            ViewBag.Author = GetAuthor(id, 3, "");
            return(View(record));
        }
예제 #3
0
        public JsonResult UpdateNews(Common.News viewNews)
        {
            try
            {
                NewsBusiness newsBusiness = new NewsBusiness();
                var          dbNews       = newsBusiness.GetById(viewNews.Id);
                dbNews.NewsGroupId     = viewNews.NewsGroupId;
                dbNews.Title           = viewNews.Title;
                dbNews.ImageSource     = viewNews.ImageSource;
                dbNews.Summary         = viewNews.Summary;
                dbNews.Descriptions    = viewNews.Descriptions;
                dbNews.Status          = viewNews.Status;
                dbNews.isPublic        = viewNews.isPublic;
                dbNews.ModifyDate      = DateTime.Now;
                dbNews.AdminIDApproval = viewNews.AdminIDApproval;

                newsBusiness.Edit(dbNews);
                return(Json(1));//Cập nhật thành công
            }
            catch (Exception)
            {
                throw;
            }
        }