Пример #1
0
        public async Task <Guid> Create(FileModel file)
        {
            Guid guid = Guid.NewGuid();

            await _githubService.CreateFile(_githubSetting.FilePath, guid, JsonSerializer.Serialize(file));

            return(guid);
        }
Пример #2
0
        public async Task <Guid> Create(IEnumerable <MockModel> request)
        {
            Guid guid = Guid.NewGuid();

            GuidMethodsModel guidMethodsModel = new GuidMethodsModel
            {
                HttpMethods = request.Select(x => x.HttpMethod.ToUpper()).ToArray()
            };

            await _githubService.CreateFile(_guidMethodsFolderPath, guid, JsonSerializer.Serialize(guidMethodsModel));

            foreach (MockModel mock in request)
            {
                string content = JsonSerializer.Serialize(mock);
                string path    = Path.Combine(_githubSetting.HttpMethodsFolderPath, mock.HttpMethod.ToUpper());
                await _githubService.CreateFile(path, guid, content);
            }

            return(guid);
        }