public void Add(AwesomeCar car)
        {
            int id = _cars.OrderByDescending(c => c.CarId).First().CarId++;

            car.CarId           = id;
            car.CarName         = car.CarName;
            car.BrandName       = car.BrandName;
            car.producerCountry = car.producerCountry;
            _cars.Add(car);
        }
Beispiel #2
0
        public IActionResult CreateCar(CarViewModel carViewModel)
        {
            var car = new AwesomeCar
            {
                CarName         = carViewModel.CarName,
                BrandName       = carViewModel.BrandName,
                MileAge         = carViewModel.MileAge,
                producerCountry = carViewModel.producerCountry
            };

            _awesomeCarQueryHandler.Add(car);
            return(RedirectToAction("Index"));
        }
 public void Add(AwesomeCar car)
 {
     _context.Add(car);
     _context.SaveChanges();
 }