public ActionResult DeleteNews(int NewsId)
        {
            string url = String.Format("api/News/GetNewsContent?NewsID={0}", NewsId);
            GetNewsContentReturnDTO result = _apiAdaptor.Get <GetNewsContentReturnDTO>(url);

            return(View(result));
        }
        public ActionResult EditNews(int NewsId)
        {
            string url = String.Format("api/News/GetNewsContent?NewsID={0}", NewsId);
            GetNewsContentReturnDTO result = _apiAdaptor.Get <GetNewsContentReturnDTO>(url);

            EditNewsRequestDTO dto = new EditNewsRequestDTO()
            {
                NewsID      = NewsId,
                Title       = result.NewsTitle,
                Category    = result.NewsCategory,
                NewsContent = result.NewsContent
            };

            return(View(dto));
        }
示例#3
0
        /// <summary>
        /// 取得 最新消息內文
        /// </summary>
        /// <param name="NewsID"></param>
        /// <returns></returns>
        public GetNewsContentReturnDTO GetNewsContent(int NewsID)
        {
            GetNewsContentReturnDTO returnDto = null;

            News dbSet = _dbContext.Set <News>().FirstOrDefault(o => o.IsEnable == true && o.ID.Equals(NewsID));

            returnDto = new GetNewsContentReturnDTO()
            {
                NewsID       = dbSet.ID,
                NewsCategory = (enNewsCategory)Enum.Parse(typeof(enNewsCategory), dbSet.Category),
                NewsTitle    = dbSet.Title,
                NewsContent  = dbSet.NewsContent,
                CreateDate   = dbSet.CreateTime
            };

            return(returnDto);
        }