public BikeModelController(BikeDbContext context) { _context = context; ModelVM = new BikeModelVM() { Makes = _context.Makes.ToList(), BikeModel = new Models.BikeModel() }; }
public IActionResult EditPost(BikeModelVM bikeModelVM) { if (!ModelState.IsValid) { return(View(ModelVM)); } _context.Update(bikeModelVM.BikeModel); _context.SaveChanges(); return(RedirectToAction(nameof(Index))); }
public IActionResult CreatePost(BikeModelVM bikeModelVM) { if (!ModelState.IsValid) { return(View(ModelVM)); } _context.BikeModels.Add(bikeModelVM.BikeModel); _context.SaveChanges(); return(RedirectToAction("Index")); }