Beispiel #1
0
        public async Task AddGameAsync(Game game)
        {
            _context.Set <Game>().AddOrUpdate(game);
            await _context.SaveChangesAsync();

            //await _context.Database.ExecuteSqlCommandAsync("EXEC [dbo].[Games_Add] @id, @name, @description, @price, @releaseDate, @gameImage, @backImage, @previewLink, @publisherId, @categoryId, @quantity, @shortId",
            //		new SqlParameter("@id", game.GameId),
            //		new SqlParameter("@name", game.Name),
            //		new SqlParameter("@description", game.Description),
            //		new SqlParameter("@price", game.Price),
            //		new SqlParameter("@releaseDate", game.ReleaseDate),
            //		new SqlParameter("@gameImage", (object)game.GameImage ?? DBNull.Value),
            //		new SqlParameter("@backImage", (object)game.BackImage ?? DBNull.Value),
            //		new SqlParameter("@previewLink", (object)game.PreviewLink ?? DBNull.Value),
            //		new SqlParameter("@publisherId", game.PublisherId),
            //		new SqlParameter("@categoryId", game.CategoryId),
            //		new SqlParameter("@quantity", game.Quantity),
            //		new SqlParameter("@shortId", game.ShortId));
        }
Beispiel #2
0
 public async Task AddAdminAsync(Administrator administrator)
 {
     _context.Administrators.Add(administrator);
     await _context.SaveChangesAsync();
 }