public IActionResult CreatePost() { if (!ModelState.IsValid) { return(View(modelViewModel)); } _vroomAppDbContext.Add(modelViewModel.Model); _vroomAppDbContext.SaveChanges(); return(RedirectToAction(nameof(IndexModel))); }
public IActionResult Create(Make make) { if (ModelState.IsValid) { Make newMake = new Make() { Name = make.Name }; _vroomAppDbContext.Add(newMake); _vroomAppDbContext.SaveChanges(); //return RedirectToAction("make" , new {id = newMake.Id}); return(RedirectToAction(nameof(IndexMakeList))); } return(View(make)); }