コード例 #1
0
        public FavoriteUserRelation Map(FavoriteUserRelationModel from, FavoriteUserRelation to)
        {
            to.SourceUserId = from.SourceUserId;
            to.TargetUserId = from.TargetUserId;

            return(to);
        }
コード例 #2
0
        public async Task CrudTest()
        {
            var relation = new FavoriteUserRelation
            {
                SourceUserId = "1",
                TargetUserId = "2"
            };

            await this.favoriteUserRepository.AddAsync(relation);

            var relationIds = await this.favoriteUserRepository.GetFavoriteUserIds(relation.SourceUserId);

            Assert.True(relationIds.Contains(relation.TargetUserId));

            await this.favoriteUserRepository.RemoveAsync(relation);
        }
コード例 #3
0
 public async Task RemoveAsync(FavoriteUserRelation relation)
 {
     await this.dbContext.FavriteUserRelations.DeleteOneAsync(
         x => x.SourceUserId == relation.SourceUserId &&
         x.TargetUserId == relation.TargetUserId);
 }
コード例 #4
0
 public async Task AddAsync(FavoriteUserRelation relation)
 {
     await this.dbContext.FavriteUserRelations.InsertOneAsync(relation);
 }