Exemplo n.º 1
0
        public ConsultantCalendar GetConsultantCalendar(int consultantId)
        {
            try
            {
                HttpResponseMessage responseContent = requestMethod.GetContent(string.Format("{0}ConsultantCalendar/{1}?", restService, id));
                if (responseContent.StatusCode == HttpStatusCode.OK)
                {
                    var consultantCalendar = Deserialize <ConsultantCalendar>(responseContent.Content.ReadAsStringAsync().Result);
                    return(consultantCalendar);
                }
                else if (responseContent.StatusCode == HttpStatusCode.BadRequest)
                {
                    modelStateErrors = Deserialize <ReturnErrorModel>(responseContent.Content.ReadAsStringAsync().Result);
                    return(null);
                }
                else if (responseContent.StatusCode == HttpStatusCode.InternalServerError)
                {
                    modelExceptionErrors = Deserialize <ExceptionHandler>(responseContent.Content.ReadAsStringAsync().Result);
                    return(null);
                }

                return(null);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }