Beispiel #1
0
        /// <summary>
        /// Creates a new guild and adds it to the Guilds database table
        /// </summary>
        /// <param name="guild">Guild object to be added</param>
        /// <returns>Created Guild</returns>
        public async Task <GuildsDTO> Create(GuildsDTO dto)
        {
            Guilds guild = new Guilds()
            {
                Name = dto.Name
            };

            _context.Entry(guild).State = EntityState.Added;
            await _context.SaveChangesAsync();

            dto.Id = guild.Id;
            return(dto);
        }
Beispiel #2
0
        /// <summary>
        /// adds to the game db
        /// </summary>
        /// <param name="games"></param>
        /// <returns>returns created game</returns>
        public async Task <GamesDTO> Create(GamesDTO gamesDTO)
        {
            Games games = new Games()
            {
                Name = gamesDTO.Name
            };

            _context.Entry(games).State = EntityState.Added;
            await _context.SaveChangesAsync();

            gamesDTO.Id = games.Id;
            return(gamesDTO);
        }