public ActionResult Retirer(int id)
        {
            bool sauvPanierClient = Client.Id != 0 ? true : false;

            if (id < PanierViewModel.ArticlesDetailsViewModel.Count)
            {
                Article           article = new ArticleDAL().Details(PanierViewModel.ArticlesDetailsViewModel[id].Article.Id);
                PanierDAL         panierDAL;
                PanierProspectDAL panierProspectDAL;
                PanierViewModel.PrixTotalTTC = Math.Round(PanierViewModel.PrixTotalTTC - article.PrixTTC, 2);

                if (PanierViewModel.ArticlesDetailsViewModel[id].Quantite > 1)
                {
                    PanierViewModel.ArticlesDetailsViewModel[id].Quantite--;
                    PanierViewModel.ArticlesDetailsViewModel[id].PrixTotalTTC = Math.Round(PanierViewModel.ArticlesDetailsViewModel[id].PrixTotalTTC - PanierViewModel.ArticlesDetailsViewModel[id].Article.PrixTTC, 2);
                    if (sauvPanierClient)
                    {
                        panierDAL = new PanierDAL(Client.Id);
                        panierDAL.ModifierQuantite(article, -1);
                    }
                    else
                    {
                        panierProspectDAL = new PanierProspectDAL(ProspectGuid);
                        panierProspectDAL.ModifierQuantite(article, -1);
                    }
                }
                else
                {
                    PanierViewModel.ArticlesDetailsViewModel.RemoveAt(id);
                    if (sauvPanierClient)
                    {
                        panierDAL = new PanierDAL(Client.Id);
                        panierDAL.Supprimer(article);
                    }
                    else
                    {
                        panierProspectDAL = new PanierProspectDAL(ProspectGuid);
                        panierProspectDAL.Supprimer(article);
                    }
                }
                ViewBag.Panier = PanierViewModel;
            }
            return(Redirect(Request.UrlReferrer.AbsolutePath));
        }
 private void AgregerPanierEnBase()
 {
     if (Client != null && Client.Id != 0)
     {
         PanierDAL lePanierDal = new PanierDAL(Client.Id);
         foreach (ArticleViewModel article in PanierViewModel.ArticlesDetailsViewModel)
         {
             Panier panier = lePanierDal.ListerPanierClient().Find(pan => pan.ArticleId == article.Article.Id);
             if (panier == null)
             {
                 lePanierDal.Ajouter(article.Article, article.Quantite);
             }
             else
             {
                 lePanierDal.ModifierQuantite(article.Article, article.Quantite);
             }
         }
     }
 }
        private void RecupererPanierProspectPuisSupprimer()
        {
            PanierProspectDAL panierProspectDAL   = new PanierProspectDAL(ProspectGuid);
            PanierViewModel   panierViewModelSauv = new PanierViewModel(panierProspectDAL.ListerPanierProspect());

            if (panierViewModelSauv != null && Client.Id != 0)
            {
                PanierDAL panierDal = new PanierDAL(Client.Id);
                foreach (ArticleViewModel article in (panierViewModelSauv).ArticlesDetailsViewModel)
                {
                    Panier panier = panierDal.ListerPanierClient().Find(pan => pan.ArticleId == article.Article.Id);
                    if (panier == null)
                    {
                        panierDal.Ajouter(article.Article, article.Quantite);
                    }
                    else
                    {
                        panierDal.ModifierQuantite(article.Article, article.Quantite);
                    }
                }
            }
            panierProspectDAL.Supprimer();
        }