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