public async Task <IActionResult> UploadAttachment(IFormFile file, Guid questionId, Guid testExistId) { if (file != null) { byte[] attachment; using (var memoryStream = new MemoryStream()) { await file.CopyToAsync(memoryStream); attachment = memoryStream.ToArray(); } await _repository.CreateAnswerFree(attachment, questionId, testExistId); return(Ok()); } return(BadRequest()); }