public IActionResult Create(CreateNewsInputModel model) { var news = newsService.CreateNews(model); this.Db.News.Add(news); this.Db.SaveChanges(); return(this.RedirectToPage("/Home/Index")); }
public News CreateNews(CreateNewsInputModel model) { var news = new News { Id = model.Id, Name = model.Name, Content = model.Description, PublishedOn = model.PublishedOn }; if (news == null) { throw new ApplicationException("Invalid information provided"); } return(news); }