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); }
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); }