private void btnValiderGestion_Click(object sender, RoutedEventArgs e)
        {
            var imageSelected = (object)this.PictureDataGrid.SelectedItem;
            ValidationForm.ValidationInput(this.txtBoxCP.Text.Trim(), "Code postal");
            ValidationForm.ValidationInput(this.txtBoxNom.Text.Trim(), "Nom");
            ValidationForm.ValidationInput(this.txtBoxRue.Text.Trim(), "Rue");

            InfoRestaurant lstInfoRestaurant = new InfoRestaurant()
            {
                Id = int.Parse(this.labelID.Content.ToString()),
                Nom = this.txtBoxNom.Text.Trim(),
                Cp = this.txtBoxCP.Text.Trim(),
                Rue = this.txtBoxRue.Text.Trim(),
                Active = this.checkBoxActive.IsChecked
            };

            byte[] byteImage = new byte[] { };
            string name = string.Empty;

            foreach (var file in Directory.EnumerateFiles(this.lbPathFolder.Content.ToString()))
            {
                name = Path.GetFileName(file);
                byteImage = ConvertPicture.ImageToByteArray(file);
            }

            UpdateModel.Update(lstInfoRestaurant, byteImage,name);

            //string path = this.lbPathFolder.Content.ToString();
            //foreach (var imagefilePath in Directory.EnumerateFiles(path))
            //{
            //    var imageByte = ConvertPicture.ImageToByteArray(imagefilePath);
            //    Insert.AddPicture(restaurant.Id, imageByte);
            //}
        }
 public static void Update(InfoRestaurant lstInfoRestaurant,byte[] img,string name)
 {
     using (var model = new RestoBookEntities())
     {
         var image = new Picture();
         var restaurants = model.Restaurants.Find(lstInfoRestaurant.Id);
         var addresse = model.Adresse.Find(restaurants.Id_Restaurant);
         addresse.lb_codepostal = lstInfoRestaurant.Cp;
         addresse.lb_rue = lstInfoRestaurant.Rue;
         restaurants.lb_nom = lstInfoRestaurant.Nom;
         restaurants.isActive = lstInfoRestaurant.Active;
         image.lb_Name = name;
         image.lb_Picure = img;
         restaurants.Picture.Add(image);
         restaurants.Adresse.Add(addresse);
         model.Entry(restaurants).State = System.Data.Entity.EntityState.Modified;
         model.SaveChanges();
     }
 }