public static Models.Profile ReadProfile(ContentServiceConfiguration settings, long profileId) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(settings.BaseUrl); // api/modules client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("api-version", "1.0"); HttpResponseMessage response = client.GetAsync(settings.ResourceRoot + "/profiles/" + profileId.ToString()).Result; if (response.IsSuccessStatusCode) { string stringData = response.Content.ReadAsStringAsync().Result; return(JsonConvert.DeserializeObject <Models.Profile>(stringData)); } } return(null); }
public static Models.Profile CreateProfile(ContentServiceConfiguration settings, Models.Profile newProfile) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(settings.BaseUrl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("api-version", "1.0"); var stringContent = new StringContent(JsonConvert.SerializeObject(newProfile), Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync(settings.ResourceRoot + "/profiles", stringContent).Result; if (response.IsSuccessStatusCode) { string stringData = response.Content.ReadAsStringAsync().Result; return(JsonConvert.DeserializeObject <Models.Profile>(stringData)); } } return(null); }
public FeedbacksController(IOptions <ApiSettings> settings) { this._contentSettings = settings.Value.ContentService; }
public StaffCouncilController(IOptions <ApiSettings> settings) { this._contentSettings = settings.Value.ContentService; }
public ProfilesController(IOptions <ApiSettings> settings) { this._contentSettings = settings.Value.ContentService; }
public ImprovementProposals(IOptions <ApiSettings> settings) { this._contentSettings = settings.Value.ContentService; }