예제 #1
0
        public PartialViewResult EditionFormulaireTravail(int id)
        {
            temps tps = cnx.temps.Where(t => t.id_temps == id).Single();
            var typesTravail = from travail in cnx.type_temps
                               where (travail.absence == false)
                               select new { nomTravail = travail.nom, id_type_travail = travail.id_type_temps };
            ViewBag.type_travail = new SelectList(typesTravail, "id_type_travail", "nomTravail", tps.id_type_temps);

            var projets = from p in cnx.projet
                          where ( p.z_actif == true)
                          select new { nomProjet = p.reference + " " + p.nom + " / " + p.client.nom, id_projet = p.id_projet };
            ViewBag.id_projet = new SelectList(projets, "id_projet", "nomProjet", tps.id_projet);

            ViewBag.id_tache = new SelectList(cnx.tache, "id_tache", "nom_tache", tps.id_tache);
            TravailView travailview = new TravailView();
            travailview.UpdateFromModel(tps);
            ViewBag.type = "editer";
            return PartialView("_formTravail", travailview);
        }