private HttpRequestMessage CreateRequest(string uri, HttpMethod httpMethod, Model.Authorization authorization)
        {
            HttpRequestMessage request = CreateRequest(uri, httpMethod);

            request.Headers.Add("Authorization", authorization.CreateHeader());
            return(request);
        }
        public async Task <EntityList <Reservation> > GetReservationsAsync(Model.Authorization authorization)
        {
            HttpRequestMessage       request = CreateRequest("reservations", HttpMethod.Get, authorization);
            EntityList <Reservation> list    = await ProcessListRequest <Reservation>(request);

            if (list == null)
            {
                list = new EntityList <Reservation>();
            }
            return(list);
        }
        public async Task <Reservation> GetReservationAsync(int identifier, Model.Authorization authorization)
        {
            HttpRequestMessage request = CreateRequest("reservations/" + identifier.ToString(), HttpMethod.Get, authorization);

            return(await ProcessRequest <Reservation>(request));
        }
        public async Task LoginAsync(Model.Authorization authorization)
        {
            HttpRequestMessage request = CreateRequest("login", HttpMethod.Post, authorization);

            await ProcessNoResponseRequest(request);
        }
        public async Task CreateUserAsync(Model.Authorization authorization)
        {
            HttpRequestMessage request = CreateRequest("register", HttpMethod.Post, authorization);

            await ProcessNoResponseRequest(request);
        }
        private HttpRequestMessage CreateRequest <T>(string uri, HttpMethod httpMethod, Model.Authorization authorization, T entity)
        {
            HttpRequestMessage request = CreateRequest(uri, httpMethod, authorization);
            string             json    = JsonConvert.SerializeObject(entity);

            request.Content = new StringContent(json, Encoding.UTF8, "application/json");
            return(request);
        }
        public async Task UpdateReservationAsync(Model.Authorization authorization, int identifier, Reservation reservation)
        {
            HttpRequestMessage request = CreateRequest("reservations/" + identifier.ToString(), HttpMethod.Put, authorization, reservation);

            await ProcessNoResponseRequest(request);
        }
        public async Task <string> MakeReservationAsync(Model.Authorization authorization, Reservation reservation)
        {
            HttpRequestMessage request = CreateRequest("reservations/", HttpMethod.Post, authorization, reservation);

            return(await ProcessStringRequest(request));
        }