コード例 #1
0
        public async Task <LeaderBoard> AddAsync(
            LeaderBoard leaderBoard)
        {
            var leaderBoardContainer =
                _cosmosDatabase.Containers["leaderboards"];

            var leaderBoardDocument =
                await leaderBoardContainer.Items.CreateItemAsync <LeaderBoard>(
                    leaderBoard.Id.ToString(),
                    leaderBoard);

            return(leaderBoardDocument.Resource);
        }
コード例 #2
0
        public async Task <LeaderBoard> UpdateByIdAsync(
            Guid id,
            LeaderBoard leaderBoard)
        {
            var leaderBoardContainer =
                _cosmosDatabase.Containers["leaderboards"];

            var leaderBoardDocument =
                await leaderBoardContainer.Items.ReplaceItemAsync <LeaderBoard>(
                    id.ToString(),
                    id.ToString(),
                    leaderBoard);

            return(leaderBoardDocument.Resource);
        }
コード例 #3
0
 public LearnerLeaderBoard(
     LeaderBoard leaderBoard)
 {
     this.Id   = leaderBoard.Id;
     this.Name = leaderBoard.Name;
 }