Ejemplo n.º 1
0
        public async Task <IActionResult> UploadNewGame(IFormFile file, string GameName)
        {
            string fileName;
            Game   newGameObj = new Game();

            newGameObj.GameName = GameName;
            if (file != null && file.Length > 0)
            {
                fileName = ContentDispositionHeaderValue.Parse(file.ContentDisposition).FileName.Trim('"');
                System.Diagnostics.Debug.WriteLine(fileName);
                newGameObj.GameLogo = fileName;
            }
            // right now saving fileName instead of url to image

            System.Diagnostics.Debug.WriteLine(newGameObj);
            await _game.AddGameAsync(newGameObj);

            return(Ok());
        }