Exemplo n.º 1
0
        [HttpPost("newgame")]                                      // lern to test this one propertly

        public IEnumerable <Game> newgame([FromBody] Game auxGame) //receives a a formated json object, then adds it to the database
        {
            using (var context = new gameApiContext())
            {
                context.Add(auxGame);
                context.SaveChanges();
                return(context.Games.Where(Game => Game.GameName == auxGame.GameName).ToList()); //returns the new game in json format (in theory)
            }
        }
Exemplo n.º 2
0
        [HttpPost("newstudio")]                                            // lern to test this one propertly

        public IEnumerable <Studio> newstudio([FromBody] Studio auxStudio) //receives a a formated json object, then adds it to the database
        {
            using (var context = new gameApiContext())
            {
                context.Add(auxStudio);
                context.SaveChanges();
                return(context.Studios.Where(Studio => Studio.StudioName == auxStudio.StudioName).ToList()); //returns the studio in json format (in theory)
            }
        }