public async Task <IActionResult> Create([Bind("Id,UserName")] User user) { if (ModelState.IsValid) { _context.Add(user); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(user)); }
public async Task <IActionResult> Create([Bind("Id,Text,UserId,TimeStamp")] Tweet tweet) { if (ModelState.IsValid) { _context.Add(tweet); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Id", tweet.UserId); return(View(tweet)); }