Ejemplo n.º 1
0
        public ActionResult ListeDemandes()
        {
            List <DemandeModel> list = new List <DemandeModel>();

            foreach (var c in s.GetAll())
            {
                DemandeModel d = new DemandeModel();

                d.idDemande   = c.idDemande;
                d.anneeExp    = c.anneeExp;
                d.bac         = c.bac;
                d.competance  = c.competance;
                d.description = c.description;
                d.diplome     = c.diplome;
                d.cout        = c.cout;
                d.duree       = c.duree;
                d.directeur   = c.directeur;
                d.nomProjet   = c.nomProjet;



                list.Add(d);
            }
            return(View(list));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            DemandeModel project = new DemandeModel();

            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:9080/Advyteam-web/");
            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            //houni essta3mlt service GetProjectById
            HttpResponseMessage response = client.GetAsync("api/rech/demande/" + id).Result;

            if (response.IsSuccessStatusCode)
            {
                project = response.Content.ReadAsAsync <DemandeModel>().Result;
                UpdateModel(project, collection);

                // TODO: Add insert logic here

                HttpClient client2 = new HttpClient();
                client2.BaseAddress = new Uri("http://localhost:9080/Advyteam-web/");
                client2.PutAsJsonAsync <DemandeModel>("rech/Approuver/" + id, project).ContinueWith((postTask) => postTask.Result.IsSuccessStatusCode);
                return(RedirectToAction("IndexDemande"));
            }
            else
            {
                return(View());
            }
        }
Ejemplo n.º 3
0
        // GET: Demande/Details/5
        public ActionResult Details(int id)
        {
            var c = s.GetById(id);

            DemandeModel d = new DemandeModel();

            d.idDemande   = c.idDemande;
            d.anneeExp    = c.anneeExp;
            d.bac         = c.bac;
            d.competance  = c.competance;
            d.description = c.description;
            d.diplome     = c.diplome;
            d.cout        = c.cout;
            d.directeur   = c.directeur;
            d.duree       = c.duree;
            d.nomProjet   = c.nomProjet;

            return(View(d));
        }
Ejemplo n.º 4
0
        public ActionResult RequestDemande(long mission_id, DemandeModel m)
        {
            try
            {
                // TODO: Add delete logic here
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri("http://localhost:9080/Advyteam-web/");

                // TODO: Add insert logic here

                client.PostAsJsonAsync <DemandeModel>("api/missions/demandeAdd?mission_id=" + mission_id, m)
                .ContinueWith((postTask) => postTask.Result.ReasonPhrase.Equals("Created"));
                return(RedirectToAction("IndexDemande"));
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 5
0
        public ActionResult Create(DemandeModel DM)
        {
            demande d = new demande();

            d.idDemande   = DM.idDemande;
            d.nomProjet   = DM.nomProjet;
            d.directeur   = DM.directeur;
            d.diplome     = DM.diplome;
            d.description = DM.description;
            d.bac         = DM.bac;
            d.anneeExp    = DM.anneeExp;
            d.cout        = DM.cout;
            d.competance  = DM.competance;
            d.duree       = DM.duree;


            s.Add(d);
            s.Commit();
            return(RedirectToAction("demandeEnvoye"));
        }
Ejemplo n.º 6
0
        public ActionResult Edit(long id)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:9080/Advyteam-web/");
            client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage response = client.GetAsync("api/rech/demande/" + id).Result;
            DemandeModel        project  = new DemandeModel();

            if (response.IsSuccessStatusCode)
            {
                project = response.Content.ReadAsAsync <DemandeModel>().Result;
            }
            else
            {
                ViewBag.project = "erreur";
            }

            return(View(project));
        }