This commit is contained in:
2020-06-11 23:14:12 +00:00
parent f34b3907c7
commit 9a16cd0d2d
2 changed files with 15 additions and 17 deletions

View File

@@ -5,6 +5,10 @@ namespace AyaNova.Models
public class RequestTrial public class RequestTrial
{ {
public RequestTrial()
{
DbId = Guid.Empty;//default this because it's coming from the client without a dbid as the server will set it before forwarding it on
}
[Required] [Required]
public Guid DbId { get; set; } public Guid DbId { get; set; }
[Required, EmailAddress] [Required, EmailAddress]

View File

@@ -442,19 +442,13 @@ namespace AyaNova.Core
/// <returns>Result string</returns> /// <returns>Result string</returns>
internal static async Task<string> RequestTrialAsync(RequestTrial trialRequest, ILogger log) internal static async Task<string> RequestTrialAsync(RequestTrial trialRequest, ILogger log)
{ {
Microsoft.AspNetCore.Http.Extensions.QueryBuilder q = new Microsoft.AspNetCore.Http.Extensions.QueryBuilder();
trialRequest.DbId = ServerDbId; trialRequest.DbId = ServerDbId;
log.LogDebug($"Requesting trial license for DBID {LicenseDbId.ToString()}"); log.LogDebug($"Requesting trial license for DBID {LicenseDbId.ToString()}");
string sUrl = $"{LICENSE_SERVER_URL}rvr" + q.ToQueryString(); string sUrl = $"{LICENSE_SERVER_URL}rvr";
try try
{ {
// var content = new StringContent(jsonObject.ToString(), Encoding.UTF8, "application/json");
// var result = client.PostAsync(url, content).Result;
var content = new StringContent(JsonConvert.SerializeObject(trialRequest), Encoding.UTF8, "application/json"); var content = new StringContent(JsonConvert.SerializeObject(trialRequest), Encoding.UTF8, "application/json");
var client = ServiceProviderProvider.HttpClientFactory.CreateClient(); var client = ServiceProviderProvider.HttpClientFactory.CreateClient();
var res = await client.PostAsync(sUrl, content); var res = await client.PostAsync(sUrl, content);
if (res.IsSuccessStatusCode) if (res.IsSuccessStatusCode)