//Async task for getting User Details public async Task <string> Getuserinfo(string userid) { string userinfo = string.Empty; try { if (!string.IsNullOrEmpty(WebApiRootURL)) { //Creates the enpoint uri to be called StringBuilder EndPointUri = new StringBuilder(WebApiRootURL); string api = string.Format(SettingsHelper.PersonalizationAPIUser, userid); Uri APIEndPointUri = new Uri(EndPointUri.Append(string.Format(api)).ToString()); Helper JsonHelperObj = new Helper(); //Gets the response returned by the Personalization API userinfo = await JsonHelperObj.APIGetCall(string.Format(APIEndPointUri.ToString())); return(userinfo); } else { //Write the trace in db that no url exists LoggerHelper.WriteToLog("WebApiRootURL URL is null", CoreConstants.Priority.High, CoreConstants.Category.Error); return(null); } } catch (Exception exception) { // logging an error if in case some exception occurs LoggerHelper.WriteToLog(exception, "Error while fetching the most popular videos" + exception.ToString()); throw new DataAccessException("Data Access Exception:-Error while fetching Getuserinfo "); } }
//Async task for getting backend applications public async Task <string> Getbackendapplications() { string allBackendApps = string.Empty; try { if (!string.IsNullOrEmpty(WebApiRootURL)) { //Creates the enpoint uri to be called StringBuilder EndPointUri = new StringBuilder(WebApiRootURL); Uri APIEndPointUri = new Uri(EndPointUri.Append(string.Format(SettingsHelper.PersonalizationAPIBackend)).ToString()); Helper JsonHelperObj = new Helper(); //Gets the response returned by the Personalization API allBackendApps = await JsonHelperObj.APIGetCall(string.Format(APIEndPointUri.ToString())); } else { //Write the trace in db that no url exists LoggerHelper.WriteToLog("WebApiRootURL URL is null", CoreConstants.Priority.High, CoreConstants.Category.Error); return(null); } } catch (Exception exception) { LoggerHelper.WriteToLog(exception + " - Error while creating client context : " + exception.ToString(), CoreConstants.Priority.High, CoreConstants.Category.Error); } return(allBackendApps); }