예제 #1
0
        public async Task <IActionResult> Create(Guid userId, [FromForm] CallRecordRequest request, [Required] IFormFile file)
        {
            var callRecord = m_Mapper.Map <CallRecord>(request);

            callRecord.OwnerId = userId;

            var fileBytes  = IOExtensions.StreamToBytes(file?.OpenReadStream());
            var saveResult = await m_CallRecordManager.Instance.SaveFileAsync(callRecord, file?.FileName, fileBytes);

            if (saveResult.IsSuccess)
            {
                callRecord.FileId = saveResult.Data;
                await m_CallRecordManager.Instance.CreateAsync(callRecord);
            }

            return(Json(saveResult));
        }