public ActionResult Edit(ArrivalVm avm)
        {
            user user = Session["user"] as user;

            if (user != null)
            {
                arrival arrival = new arrival()
                {
                    idArrival    = avm.idArrival,
                    arrivalDate  = avm.arrivalDate,
                    flightNumber = avm.flightNumber
                };
                HttpClient client = new HttpClient();
                client.BaseAddress = new Uri("http://localhost:18080");
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.PutAsJsonAsync <arrival>("/l4c_map-v2-web/rest/arrival", arrival).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());
                return(RedirectToAction("Profile", "Applicant"));
            }
            return(View());
        }
        // GET: Arrival/Edit/5
        public ActionResult Edit(int id)
        {
            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://localhost:18080");
            Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage response = Client.GetAsync("/l4c_map-v2-web/rest/arrival/" + id).Result;

            if (response.IsSuccessStatusCode)
            {
                arrival   arrival = response.Content.ReadAsAsync <arrival>().Result;
                ArrivalVm avm     = new ArrivalVm()
                {
                    idArrival    = arrival.idArrival,
                    arrivalDate  = arrival.arrivalDate,
                    flightNumber = arrival.flightNumber
                };
                return(View(avm));
            }
            return(View());
        }
        public new ActionResult Profile(ApplicantVm applicantvm)
        {
            var user = (user)Session["user"];

            if (user != null && user.role.Equals("Responsable"))
            {
                user.id = applicantvm.id;
            }
            if (user != null)
            {
                HttpClient Client = new HttpClient();
                Client.BaseAddress = new Uri("http://localhost:18080");
                Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = Client.GetAsync("/l4c_map-v2-web/rest/applicant/" + user.id).Result;
                if (response.IsSuccessStatusCode)
                {
                    applicant   applicant = response.Content.ReadAsAsync <applicant>().Result;
                    ApplicantVm avm       = new ApplicantVm()
                    {
                        id              = applicant.id,
                        age             = applicant.age,
                        applicantState  = applicant.applicantState,
                        chanceOfSuccess = applicant.chanceOfSuccess,
                        country         = (PaysVm)Enum.Parse(typeof(PaysVm), applicant.country),
                        lastname        = applicant.lastname,
                        name            = applicant.name,
                        role            = applicant.role,
                        username        = applicant.username,
                        picture         = applicant.picture,
                        demand          = applicant.demand,
                        arrival         = applicant.arrival
                    };
                    ArrivalVm arrivalvm = new ArrivalVm()
                    {
                        arrivalDate  = avm.arrival.arrivalDate,
                        idArrival    = avm.arrival.idArrival,
                        flightNumber = avm.arrival.flightNumber
                    };
                    avm.arrivalvm = arrivalvm;
                    Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    HttpResponseMessage response_test = Client.GetAsync("/l4c_map-v2-web/rest/test/").Result;
                    if (response_test.IsSuccessStatusCode)
                    {
                        ICollection <test> alltest = (ICollection <test>)response_test.Content.ReadAsAsync <IEnumerable <test> >().Result;

                        foreach (test test in alltest)
                        {
                            TestVm tvm = new TestVm()
                            {
                                dateOfPassing = test.dateOfPassing,
                                difficulty    = test.difficulty,
                                //files = test.files,
                                //idResponsable = test.idResponsable,
                                idTest    = test.idTest,
                                mark      = test.mark,
                                name      = test.name,
                                specialty = test.specialty,
                            };
                            Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                            HttpResponseMessage      response_question = Client.GetAsync("/l4c_map-v2-web/rest/question/" + test.idTest).Result;
                            ICollection <QuestionVm> allquestion       = (ICollection <QuestionVm>)response_question.Content.ReadAsAsync <IEnumerable <QuestionVm> >().Result;
                            foreach (QuestionVm question in allquestion)
                            {
                                tvm.questions.Add(new QuestionVm()
                                {
                                    correct    = question.correct,
                                    idQuestion = question.idQuestion,
                                    syn1       = question.syn1,
                                    syn2       = question.syn2,
                                    syn3       = question.syn3,
                                    task       = question.task,
                                    test       = question.test
                                });
                            }
                            avm.tests.Add(tvm);
                        }
                        Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                        HttpResponseMessage response_testpassed = Client.GetAsync("/l4c_map-v2-web/rest/test/" + user.id).Result;
                        if (response_testpassed.IsSuccessStatusCode)
                        {
                            ICollection <test> testpassed = (ICollection <test>)response_testpassed.Content.ReadAsAsync <IEnumerable <test> >().Result;
                            foreach (test test in testpassed)
                            {
                                avm.testpassed.Add(new TestVm()
                                {
                                    dateOfPassing = test.dateOfPassing,
                                    difficulty    = test.difficulty,
                                    idTest        = test.idTest,
                                    mark          = test.mark,
                                    name          = test.name,
                                    specialty     = test.specialty
                                });
                            }
                        }
                    }
                    foreach (var passed in avm.testpassed)
                    {
                        avm.tests.Remove(passed);
                    }
                    return(View(avm));
                }
            }
            return(RedirectToAction("Error", "Shared"));
        }