public ActionResult DetailContrat(Contrat contrat)
        {
            Contrat c = new Contrat();
            Client client = new Client();

            c.DetailClient = client.GetClientById(contrat.id_client);

            return RedirectToAction("DetailContrat", contrat);
        }
        public void GetResultSearch(string type, string motRechercher)
        {
            List<Contrat> ls = new List<Contrat>();

            using (HandicapsEntities bdd = new HandicapsEntities())// Utilisation de la bdd
            {
                switch(type)
                {
                    case "contrat":
                        var req = (from c in bdd.Contrat
                               where c.id == Convert.ToInt32(motRechercher)
                               select new
                               {
                                   numero = result.id,
                                   antenne = result.Antenne,
                                   type = result.type_intervention,
                                   dateSign = result.date_signature,
                                   garantie = result.date_echeance
                               }).ToList();
                        break;
                    case "materiel":
                        var req = (from result in bdd.Contrat
                                   where result.id == Convert.ToInt32(motRechercher)
                                   select new
                                   {
                                       numero = result.id,
                                       antenne = result.Antenne,
                                       type = result.type_intervention,
                                       dateSign = result.date_signature,
                                       garantie = result.date_echeance
                                   }).ToList();
                        break;
                    case "intervention":
                        var req = (from result in bdd.Contrat
                                   where result.id == Convert.ToInt32(motRechercher)
                                   select new
                                   {
                                       numero = result.id,
                                       antenne = result.Antenne,
                                       type = result.type_intervention,
                                       dateSign = result.date_signature,
                                       garantie = result.date_echeance
                                   }).ToList();
                        break;
                    default:
                        break;
                }
                if (type == "contrat")
                {

                    if (req != null)
                    {
                        foreach (var l in req)
                        {
                            Contrat c = new Contrat();
                            c.id = l.numero;
                            c.Antenne = l.antenne;
                            c.type_intervention = l.type;
                            c.date_signature = l.dateSign;
                            c.date_echeance = l.garantie;

                            ls.Add(c);
                        }
                    }
                }
            }
        }
 public ActionResult AjouterContrat(Contrat contrat)
 {
     return View();
 }
        /// <summary>
        /// Récupere la liste des contrats du client
        /// </summary>
        /// <param name="idClient"></param>
        /// <returns></returns>
        public List<Contrat> GetListContratById(int idClient)
        {
            List<Contrat> ls = new List<Contrat>();

            using (HandicapsEntities bdd = new HandicapsEntities())// Utilisation de la bdd
            {
                var req = ( from data in bdd.Contrat
                            where data.id_client == idClient
                            select new
                            {
                                numero = data.id,
                                antenne = data.Antenne,
                                type = data.type_intervention,
                                dateSign = data.date_signature,
                                garantie = data.date_echeance
                            }).ToList();

                if (req != null)
                {
                    foreach (var l in req)
                    {
                        Contrat c = new Contrat();
                        c.id = l.numero;
                        c.Antenne = l.antenne;
                        c.type_intervention = l.type;
                        c.date_signature = l.dateSign;
                        c.date_echeance = l.garantie;

                        ls.Add(c);
                    }
                }
            }

            return ls;
        }