public async Task <IActionResult> Edit(int id, [Bind("Id,Blah,WroteDate,Likes")] Witter witter) { if (id != witter.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(witter); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!WitterExists(witter.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(witter)); }
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)); }