Пример #1
0
        /// <summary>
        /// Deletes a User's NoticeBoard Following relationship
        /// </summary>
        /// <param name="id">The relationship to be deleted</param>
        /// <returns>1 if success</returns>
        public async Task <int> DeleteAsync(UserNoticeBoardFollow relationship)
        {
            UserNoticeBoardFollow noticeBoard = await DbContext.UserBoardFollowingRelationship.FindAsync(relationship.UserId, relationship.NoticeBoardId);

            DbContext.UserBoardFollowingRelationship.Remove(noticeBoard);
            return(await DbContext.SaveChangesAsync());
        }
Пример #2
0
        public async Task <bool> ExistsAsync(UserNoticeBoardFollow relationship)
        {
            var unb = await DbContext.UserBoardFollowingRelationship.FindAsync(relationship.UserId, relationship.NoticeBoardId);

            return(unb != null);
        }
Пример #3
0
 /// <summary>
 /// Adds a User's Notice Board Following relationship
 /// </summary>
 /// <param name="notice">The relationship to be added</param>
 /// <returns>1 if success</returns>
 public async Task <int> AddAsync(UserNoticeBoardFollow relationship)
 {
     DbContext.UserBoardFollowingRelationship.Add(relationship);
     return(await DbContext.SaveChangesAsync());
 }