This commit is contained in:
2020-06-13 00:10:10 +00:00
parent 7b452670f0
commit 29effecb75
3 changed files with 127 additions and 119 deletions

View File

@@ -76,7 +76,8 @@ namespace rockfishCore.Controllers
return NotFound();
//DO APPROVE
//check not already processed and ignore if so
if(trial.DtProcessed!=null){
if (trial.DtProcessed != null)
{
//already processed, nothing to do here
return BadRequest("Already processed");
}
@@ -97,7 +98,7 @@ namespace rockfishCore.Controllers
}
//Reject
//Reject
[HttpPost("reject/{id}")]
public async Task<IActionResult> RejectTrial([FromRoute] long id, [FromQuery] string rejectReason)
{
@@ -108,24 +109,26 @@ namespace rockfishCore.Controllers
return NotFound();
//DO REJECT
//check not already processed and ignore if so
if(trial.DtProcessed!=null){
if (trial.DtProcessed != null)
{
//already processed, nothing to do here
return BadRequest("Already processed");
}
//generate license key and insert in record
trial.RejectReason=rejectReason;
trial.RejectReason = rejectReason;
trial.Status = TrialRequest.TrialRequestStatus.Rejected;
trial.DtProcessed = DateUtil.NowAsEpoch();
await ct.SaveChangesAsync();
//send approved email to user
string reason=string.Empty;
if(!string.IsNullOrWhiteSpace(rejectReason)){
reason=$"The request was rejected due to:\r\n{rejectReason}";
string reason = string.Empty;
if (!string.IsNullOrWhiteSpace(rejectReason))
{
reason = $"The request was rejected due to:\r\n{rejectReason}";
}
var body = $"Your trial license request was not approved.\r\n{reason}";
//send confirmation email
RfMail.SendMessage("support@ayanova.com", trial.Email, "AyaNova trial request approved", body, false);
RfMail.SendMessage("support@ayanova.com", trial.Email, "AyaNova trial request not approved", body, false);
return Ok(trial);