public virtual async Task <T> GetAsync <T>(string uri) { Console.WriteLine(uri); int?personId = await p_AppSession.GetEmployeeID(); if (p_HttpClient.DefaultRequestHeaders.Contains("PersonId")) { p_HttpClient.DefaultRequestHeaders.Remove("PersonId"); } if (personId != null) { p_HttpClient.DefaultRequestHeaders.Add("PersonId", personId.Value.ToString()); } return(await p_HttpClient.GetFromJsonAsync <T>(uri)); }
public async override Task <IProcessTrackerBase> RunAsync(MasterProcessCmd request, CancellationToken cancellationToken = default) { int?personId = await p_AppSession.GetEmployeeID(); p_HttpClient.DefaultRequestHeaders.Clear(); if (personId != null) { p_HttpClient.DefaultRequestHeaders.Add("PersonId", personId.Value.ToString()); } HttpResponseMessage response = null; switch (request.JobID) { case MainConstants.Job.MainCalc: response = await p_HttpClient.PostAsJsonAsync ( AerishAdminConstants.Uri.CalculateMasterData, request.Parameters as CalculateParameter, cancellationToken ); break; default: break; } if (response != null && response.IsSuccessStatusCode) { string jsonResponse = await response.Content.ReadAsStringAsync(); return(JsonSerializer.Deserialize <ProcessTrackerVM>(jsonResponse)); } return(null); }