public FavoriteUserRelation Map(FavoriteUserRelationModel from, FavoriteUserRelation to)
        {
            to.SourceUserId = from.SourceUserId;
            to.TargetUserId = from.TargetUserId;

            return(to);
        }
        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);
        }
Ejemplo n.º 3
0
 public async Task RemoveAsync(FavoriteUserRelation relation)
 {
     await this.dbContext.FavriteUserRelations.DeleteOneAsync(
         x => x.SourceUserId == relation.SourceUserId &&
         x.TargetUserId == relation.TargetUserId);
 }
Ejemplo n.º 4
0
 public async Task AddAsync(FavoriteUserRelation relation)
 {
     await this.dbContext.FavriteUserRelations.InsertOneAsync(relation);
 }