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)); }
public IEnumerable <Room> GetEmptyRooms(EmptyRoomsRequest request) { return(service.GetEmptyRooms(request.Rooms, request.StartDate, request.EndDate)); }