public IActionResult Create(Producer producer) { if (ModelState.IsValid) { _context.Add(producer); _context.SaveChanges(); return(RedirectToAction("Index")); } return(View(producer)); }
public async Task <IActionResult> Create([Bind("ID,Name,Email")] 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,Content,UserID")] MicroPost microPost) { if (ModelState.IsValid) { _context.Add(microPost); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(microPost)); }