示例#1
0
        public ActionResult View(int id)
        {
            NewsService service = new NewsService();
            var data = service.FirstOrDefault(p => p.NewsID == id);
            ViewNewsModel model = new ViewNewsModel()
            {

                NewsItem = data,
            };
             return View(model);
        }
示例#2
0
        public ActionResult Edit(int id)
        {
            NewsService service = new NewsService();
            var data= service.FirstOrDefault(p=>p.NewsID == id);
            EditNewsModel model = new EditNewsModel();

            model.CopyPropertiesFrom(data);
            model.CategoryId = data.News_CategoryID;
            return View(model);
        }