Example #1
0
 public void Add(Car entity)
 {
     if (entity == null)
     {
         throw new ArgumentNullException(nameof(entity), "Car-Entity ist null");
     }
     _context.Add(entity);
 }
Example #2
0
        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));
        }