Ejemplo n.º 1
0
        public async Task <ActionResult> GetEmptyRooms(EmptyRoomsRequest request)
        {
            Request.Headers.TryGetValue("Authorization", out var token);
            if (StringValues.IsNullOrEmpty(token))
            {
                return(Unauthorized());
            }
            _client.DefaultRequestHeaders.Add("Authorization", token.FirstOrDefault());

            StringContent       httpContent = new StringContent(JsonConvert.SerializeObject(request), System.Text.Encoding.UTF8, "application/json");
            HttpResponseMessage response    = await _client.PostAsync(_reservationsServiceUrl + "emptyRooms", httpContent);

            return(Ok(response.Content.ReadAsStringAsync().Result));
        }
Ejemplo n.º 2
0
 public IEnumerable <Room> GetEmptyRooms(EmptyRoomsRequest request)
 {
     return(service.GetEmptyRooms(request.Rooms, request.StartDate, request.EndDate));
 }