Esempio n. 1
0
        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");
        }
Esempio n. 2
0
 internal NewsModel(News news)
 {
     this.Id = news.Id;
     this.ParentId = news.ParentId;
     this.Title = news.Title;
 }