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