示例#1
0
        public async Task <IActionResult> Post([FromForm] SettingsData data)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            byte[] file;
            using (var stream = new MemoryStream())
            {
                await data.File.CopyToAsync(stream);

                file = stream.ToArray();
            }

            if (file != null)
            {
                var fileName = await _blobStorageService.UploadFileToBlob(file, $"{data.GameId}.json");

                await _tableStorageService.AddEntryToTable(data.UserId, data.GameId, fileName);
            }

            return(Ok());
        }