public async Task <IActionResult> GetPaymentByuserId(CancellationToken cancellationToken, Guid?userProfileId) { //////////// var command = new PaymentGetCommand(userProfileId); var result = await Mediator.Send(command, cancellationToken).ConfigureAwait(false); return(ObjectResult(result, StatusCodes.Status200OK)); }
public async Task <FileStreamResult> GetPaymentReceiptByuserId(CancellationToken cancellationToken, Guid?userProfileId) { var command = new PaymentGetCommand(userProfileId); var result = await Mediator.Send(command, cancellationToken).ConfigureAwait(false); var memory = new MemoryStream(); using (var stream = new FileStream(result.PaymentPicPath, FileMode.Open)) { await stream.CopyToAsync(memory); } memory.Position = 0; return(File(memory, GetContentType(result.PaymentPicPath), Path.GetFileName(result.PaymentPicPath))); }