protected override async Task <EvaluationVideoReadModel> ProcessAsync(EvaluationVideoGetCommand <Guid> message, CancellationToken cancellationToken) { var search = Query <EvaluationVideoPic> .Create(x => x.Stream_id == message.Id); var query = new SingleQuery <EvaluationVideoPic>(search); var command = new EntitySingleQuery <EvaluationVideoPic, EvaluationVideoReadModel>(query); var result = await Mediator.Send(command, cancellationToken).ConfigureAwait(false); return(result.Data); }
public async Task <IActionResult> GetTrainingVideosById(CancellationToken cancellationToken, Guid fileId) { var memory = new MemoryStream(); var command = new EvaluationVideoGetCommand <Guid>(fileId); var result = await Mediator.Send(command, cancellationToken).ConfigureAwait(false); using (var stream = new FileStream(result.Path, FileMode.Open)) { await stream.CopyToAsync(memory); } memory.Position = 0; return(File(memory, GetContentType(result.Path), Path.GetFileName(result.Path))); }