Beispiel #1
0
        public async Task <IActionResult> Create([Bind("Id,TimeStamp,Text")] NewsItem newsItem)
        {
            if (ModelState.IsValid)
            {
                _context.Add(newsItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(newsItem));
        }
Beispiel #2
0
 public void CreateComment(Comment comment)
 {
     _dbContext.Add(comment);
     _dbContext.SaveChanges();
 }