private async Task <ResourceModel> CreateFileResource(Guid userId, string group, FileCreateDTO dto) { var fileName = Guid.NewGuid().ToString("N"); var resourceEntity = new ResourceModel { UserId = userId, Group = group, FileName = fileName, ContentType = dto.ContentType, CreatedDate = DateTime.UtcNow, IsWithResolution = false }; var resource = await _repository.Create(resourceEntity); await _filesService.UploadFile(group, fileName, dto.Stream); await dto.Stream.DisposeAsync(); return(resource); }
/// <summary> /// Создать ресурс (с возможностью предоставить начальное значение) /// </summary> /// <param name="value"></param> /// <returns></returns> public async Task <bool> Create(string value) { return(await _telemetryCollector.WithStopwatch(async() => await WithWebHook(async() => await _repository.Create(value)))); }