public ActionResult Add(int? parentId, string title) { using (NewsContext context = new NewsContext()) { var newNews = new News() { ParentId = parentId, Title = title }; context.News.Add(newNews); context.SaveChanges(); } return RedirectToAction("Index"); }
internal NewsModel(News news) { this.Id = news.Id; this.ParentId = news.ParentId; this.Title = news.Title; }