Example #1
0
        public async Task <IActionResult> Create(Car car)
        {
            if (ModelState.IsValid)
            {
                await context.AddAsync(car);

                await context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(car));
        }
Example #2
0
        public async Task AddCar(Car car)
        {
            await _context.AddAsync(car);

            await _context.SaveChangesAsync();
        }