Ejemplo n.º 1
0
        public JsonResult getJson(int id)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:49455/Api/");
            HttpResponseMessage response = client.GetAsync("Room/" + id).Result;

            RoomTypeRoomVM results = new RoomTypeRoomVM();

            if (response.IsSuccessStatusCode)
            {
                results = JsonConvert.DeserializeObject <RoomTypeRoomVM>(response.Content.ReadAsStringAsync().Result);
            }

            return(new JsonResult {
                Data = results, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Ejemplo n.º 2
0
        public ActionResult Index(int id)
        {
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:49455/Api/");
            HttpResponseMessage response = client.GetAsync("Room/" + id).Result;

            RoomTypeRoomVM results = new RoomTypeRoomVM();

            if (response.IsSuccessStatusCode)
            {
                results = JsonConvert.DeserializeObject <RoomTypeRoomVM>(response.Content.ReadAsStringAsync().Result);
            }

            List <IListBlobItem> v = BlobStockage.GetBlobPhoto("hotelmanagerphoto");

            foreach (var i in v)
            {
                results.BlobLinkPhoto.Add(i.Uri.AbsoluteUri.ToString());
            }

            return(View(results));
        }