public IActionResult Edit(Car carModel)
        {
            if (ModelState.IsValid)
            {
                var brandModelMatching = new CarModelValidation();

                if (brandModelMatching.AllowedModelsOnBrand[carModel.Brand.ToLower()].Contains(carModel.Model.ToLower()))
                {
                    var carFromDb = _dbContext.Car.Find(carModel.CarId);
                    carFromDb.Brand        = carModel.Brand;
                    carFromDb.EuroStandard = carModel.EuroStandard;
                    carFromDb.Model        = carModel.Model;
                    carFromDb.EngineCC     = carModel.EngineCC;
                    carFromDb.Year         = carModel.Year;
                    _dbContext.SaveChanges();

                    return(RedirectToAction("list", "car", new { area = "broker" }));
                }
                else
                {
                    ViewBag.BrandModelMatchingError = $"There is no match between {carModel.Brand} and {carModel.Model} !!!";
                    return(View(carModel)); // the brand/model combination does not exist
                }
            }
            else
            {
                return(View(carModel)); // some validation error occured, return model to the view to render the errors
            }
        }
        public IActionResult Create(Car car)
        {
            if (ModelState.IsValid)
            {
                var brandModelMatching = new CarModelValidation();

                if (brandModelMatching.AllowedModelsOnBrand[car.Brand.ToLower()].Contains(car.Model.ToLower()))
                {
                    AppUser _loggedUser = userManager.GetUserAsync(User).Result;
                    car.CarBrokerRefId = Guid.Parse(_loggedUser.Id);
                    car.CarRuleCoverId = Guid.NewGuid();

                    _unitOfWork.CarRepository.Add(car);
                    _unitOfWork.Save();

                    return(RedirectToAction("list", "car", new { area = "broker" }));
                }
                else
                {
                    ViewBag.BrandModelMatchingError = $"There is no match between {car.Brand} and {car.Model} !!!";
                    return(View(car)); // the brand/model combination does not exist
                }
            }
            else
            {
                return(View(car)); // some validation error occured, return model to the view to render the errors
            }
        }