public IActionResult New()
        {
            var viewModel = new BilNewViewModel();

            viewModel.AllColors = GetAllColorsAsSelectListItems();
            return(View(viewModel));
        }
        public IActionResult New(BilNewViewModel viewModel)
        {
            if (ModelState.IsValid)
            {
                var bil = new Bil
                {
                    Model        = viewModel.Model,
                    Manufacturer = viewModel.Manufacturer,
                    Year         = viewModel.Year,
                    Price        = viewModel.Price,
                    BilColor     = _dbContext.Colors.First(r => r.Id == Convert.ToInt32(viewModel.SelectedColorValue)),
                    //Color = viewModel.Color,
                    RegNo = viewModel.RegNo
                };
                _dbContext.Bil.Add(bil);
                _dbContext.SaveChanges();


                string filename  = bil.Id + ".jpg";
                string totalPath = Path.Combine(_environment.WebRootPath,
                                                "images", filename);
                using (var fileStream = new FileStream(totalPath, FileMode.Create))
                {
                    viewModel.NyBild.CopyTo(fileStream);
                }



                return(RedirectToAction("Index"));
            }
            viewModel.AllColors = GetAllColorsAsSelectListItems();
            return(View(viewModel));
        }