public void Add(Car entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity), "Car-Entity ist null"); } _context.Add(entity); }
public async Task <IActionResult> Create([Bind("Id,BrandName,ModelName,YearOfConstruction,Idnummer")] CarSet carSet) { if (ModelState.IsValid) { _context.Add(carSet); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(carSet)); }