public List <UserDetails> GetUserList(string userId = "", string emailId = "") { var token = _httpContextAccessor?.HttpContext?.GetTokenAsync("access_token")?.Result; string url = _config.Value.UserServiceUrl + "getUser"; if (userId != "") { url += "/" + userId; } if (emailId != "") { url += "/" + emailId; } ServiceRequest request = new ServiceRequest { Url = url, ContentType = "application/json", HttpMethod = "GET", AuthorizationHeader = token }; var webRequest = _serviceHelper.CreateWebRequest(request); BaseHttpResponse webResponse = _serviceHelper.HandleRequest(webRequest); if (webResponse.HttpStatusCode == HttpStatusCode.OK) { return(JsonConvert.DeserializeObject <List <UserDetails> >(webResponse.Description)); } _log.LogError(webResponse.Description); return(new List <UserDetails>()); }
public void SendNotification(BlindSpotNotification notification) { ServiceRequest request = new ServiceRequest { Url = _config.Value.FeedbackServiceUrl + "saveBlindSpotNotification", ContentType = "application/json", HttpMethod = "POST", Request = JsonConvert.SerializeObject(notification), AuthorizationHeader = _httpContextAccessor.HttpContext.GetTokenAsync("access_token")?.Result }; var webRequest = _serviceHelper.CreateWebRequest(request); BaseHttpResponse webResponse = _serviceHelper.HandleRequest(webRequest); if (webResponse.HttpStatusCode != HttpStatusCode.OK) { _log.LogError(webResponse.Description); } }