public async Task <IActionResult> Create([Bind("CarBrandID,CarBrandName")] CarBrand carBrand) { if (ModelState.IsValid) { _context.Add(carBrand); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(carBrand)); }
public async Task <IActionResult> Create([Bind("CarModelID,CarBrandFK,CarModelName")] CarModel carModel) { if (ModelState.IsValid) { _context.Add(carModel); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CarBrandFK"] = new SelectList(_context.CarBrand, "CarBrandID", "CarBrandName", carModel.CarBrandFK); return(View(carModel)); }
public async Task <IActionResult> Create([Bind("CarID,CarModelFK,Year,Price,Mileage")] Car car) { if (ModelState.IsValid) { _context.Add(car); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CarModelFK"] = new SelectList(_context.CarModel, "CarModelID", "CarModelName", car.CarModelFK); return(View(car)); }