public ActionResult Create(Contract_buy cb)
 {
     using (var client = new HttpClient())
     {
         client.BaseAddress = new Uri("http://localhost:8081/");
         //HTTP GET
         var responseTask = client.PostAsJsonAsync <Contract_buy>("/Contract_Buy/Add", cb).Result;
     }
     return(RedirectToAction("Index"));
 }
        public ActionResult Edit(Contract_buy contract_Buy)
        {
            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:8081/Contract_Buy/");

                //HTTP POST
                var putTask = client.PutAsJsonAsync <Contract_buy>("put", contract_Buy);
                putTask.Wait();

                var result = putTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    return(RedirectToAction("Index"));
                }
            }
            return(View(contract_Buy));
        }
        // GET: ContractBuy/Details/5

        public ActionResult Details(int id_user, int id_property)
        {
            Contract_buy contract_Buy = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:8081/Contract_Buy/");
                //HTTP GET
                var responseTask = client.GetAsync("getOne/" + id_user + "/" + id_property);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <Contract_buy>();
                    readTask.Wait();

                    contract_Buy = readTask.Result;
                }
            }
            return(View(contract_Buy));
        }