public async Task <IActionResult> Edit(int id, [Bind("Id,Title,HeadLine,DateCreated,Content")] TweetBlog tweetBlog) { if (id != tweetBlog.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tweetBlog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TweetBlogExists(tweetBlog.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tweetBlog)); }
public async Task <IActionResult> Create([Bind("Id,Title,HeadLine,DateCreated,Content")] TweetBlog tweetBlog) { if (ModelState.IsValid) { _context.Add(tweetBlog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tweetBlog)); }