public BatimentViewModel(Batiment model, BatimentCulturel modelBatCulturel)
        {
            this.model            = model;
            this.modelBatCulturel = modelBatCulturel;

            ListDeStyle       = new List <SelectListItem>();
            ListeTypeBatiment = new List <SelectListItem>();
            ListeTypeCulture  = new List <SelectListItem>();

            foreach (var v in Enum.GetValues(typeof(Models.StyleBatiment)))
            {
                var itm = new SelectListItem(v.ToString(), ((int)v).ToString());
                ListDeStyle.Add(itm);
            }
            //IEnumerable<Models.StyleBatiment> values = (IEnumerable <Models.StyleBatiment>) Enum.GetValues(typeof(Models.StyleBatiment));
            //ListDeStyle = values.Select(v => new SelectListItem(v.ToString(),((int)v).ToString()));

            foreach (var v in Enum.GetValues(typeof(Models.TypeBatiment)))
            {
                var itm = new SelectListItem(v.ToString(), ((int)v).ToString());
                ListeTypeBatiment.Add(itm);
            }

            foreach (var v in Enum.GetValues(typeof(Models.TypeCulturel)))
            {
                var itm = new SelectListItem(v.ToString(), ((int)v).ToString());
                ListeTypeCulture.Add(itm);
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("TypeCulturel,Id,Nom,Longitude,Latitude,Adresse1,Adresse2,Ville,CP,Architecte,ImageURL,Periode_construction_debut,Periode_construction_fin,Style,Siteweb")] BatimentCulturel batimentCulturel)
        {
            if (id != batimentCulturel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(batimentCulturel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BatimentCulturelExists(batimentCulturel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(batimentCulturel));
        }
        public async Task <IActionResult> Create([Bind("TypeCulturel")] BatimentCulturel batimentCulturel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(batimentCulturel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(batimentCulturel));
        }
 public BatimentViewModel()
 {
     model            = new Batiment();
     modelBatCulturel = new BatimentCulturel();
 }