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