public ActionResult Create(PublicationVM publicationvm)
        {
            UserVM userc = Session["userConnected"] as UserVM;

            Session["emp"] = userc.image;

            publication p = new publication()
            {
                description = publicationvm.description,
                id_user     = userc.id
            };

            HttpClient client = new HttpClient();

            HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, "http://localhost:9080/PIDEV-web/PIDEV/gestionEmploye/publication");
            //requestMessage.Headers.Add("Authorization", "key=AAAAG...:APA91bH7U...");
            string json = new JavaScriptSerializer().Serialize(new
            {
                description = p.description,
                user        = new { id = userc.id }
            });

            requestMessage.Content = new StringContent(json, Encoding.UTF8, "application/json");

            HttpResponseMessage response = client.SendAsync(requestMessage).GetAwaiter().GetResult();

            return(RedirectToAction("Index"));
        }
        public ActionResult Edit(int id, PublicationVM publicationVM)
        {
            publication pub = publicationService.GetById(id);

            pub.description = publicationVM.description;

            publicationService.Update(pub);
            publicationService.Commit();


            return(RedirectToAction("Index"));
        }
        // GET: Publication/Edit/5
        public ActionResult Edit(int id)
        {
            UserVM userc = Session["userConnected"] as UserVM;

            if (userc == null)
            {
                return(RedirectToAction("Create", "Login"));
            }


            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://localhost:9080");
            Client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage responce = Client.GetAsync("/PIDEV-web/PIDEV/gestionEmploye/publication/" + id).Result;

            PublicationVM Pub = responce.Content.ReadAsAsync <PublicationVM>().Result;

            ViewBag.userimg = userc.image;


            return(View(Pub));
        }