public async Task <IActionResult> Create([Bind("Id,What,Where,When,How,Why,Title")] Thing thing) { if (ModelState.IsValid) { _context.Add(thing); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(thing)); }
public async Task <ActionResult <Thing> > CreateThing(Thing thing) { _context.Things.Add(thing); await _context.SaveChangesAsync(); return(CreatedAtAction(nameof(GetThing), new { id = thing.Id }, thing)); }