public async Task <IActionResult> Create([Bind("Id,Blah,WroteDate,Likes")] Witter witter) { if (ModelState.IsValid) { witter.WroteDate = DateTime.Now; _context.Add(witter); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(witter)); }
public async Task <IActionResult> Create([Bind("Id,Name,FriendsSince,Job,Portrait")] Friend friend) { if (ModelState.IsValid) { friend.FriendsSince = DateTime.Now; _context.Add(friend); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(friend)); }