/// <summary>
        /// Ajouter un soin : Fenêtre de saisie des caractèristiques d'un soin.
        /// </summary>
        /// <returns></returns>
        public ActionResult Ajouter()
        {
            AjoutSoinViewModel ajoutSoinVM = new AjoutSoinViewModel();

            ajoutSoinVM.Produits = new List <ProduitVIewModel>();

            // Appel service pour récupérer la liste des produits :

            foreach (var produit in ProduitServiceProxy.Instance().ObtenirProduits(false))
            {
                ajoutSoinVM.Produits.Add(new ProduitVIewModel()
                {
                    Produit        = produit,
                    EstSelectionne = false
                });
            }

            return(View(ajoutSoinVM));
        }
        public ActionResult Ajouter(AjoutSoinViewModel ajoutSoinVM, HttpPostedFileBase file)
        {
            // si le model est valide :
            if (ModelState.IsValid)
            {
                ajoutSoinVM.Soin.ImageURL = ImageHelper.EnregistrerImage(
                    HttpContext,
                    file,
                    SoinRules.LargeurPhotoSoinOptimale,
                    SoinRules.HauteurPhotoSoinOptimale,
                    SoinRules.RatioTolereMin,
                    SoinRules.RatioTolereMax,
                    SoinRules.LargeurPhotoSoinMax,
                    SoinRules.DossierPhoto);

                if (ajoutSoinVM.Soin.Produits == null)
                {
                    ajoutSoinVM.Soin.Produits = new List <Produit>();
                }
                if (ajoutSoinVM.Produits != null)
                {
                    foreach (var produitVM in ajoutSoinVM.Produits)
                    {
                        if (produitVM.EstSelectionne)
                        {
                            ajoutSoinVM.Soin.Produits.Add(produitVM.Produit);
                        }
                    }
                }
                // Appel service pour ajouter le soin à la liste des soins :
                SoinServiceProxy.Instance().AjouterSoin(ajoutSoinVM.Soin);

                // On affiche la liste des soins
                return(Redirect("/Soins/Index"));
            }

            return(View(ajoutSoinVM));
        }