예제 #1
0
 public void Delete(BllFriend entity)
 {
     if (entity == null)
     {
         return;
     }
     Delete(entity.Id);
     UnitOfWork?.Commit();
 }
예제 #2
0
 public void Update(BllFriend entity)
 {
     if (entity == null)
     {
         return;
     }
     UnitOfWork?.FriendRepository?.Update(entity.ToDalFriend());
     UnitOfWork?.Commit();
 }
예제 #3
0
 /// <summary>
 /// Mapping <see cref="BllFriend"/> entity to <see cref="DalFriend"/> entity.
 /// </summary>
 public static DalFriend ToDalFriend(this BllFriend friendEntity)
 {
     return(new DalFriend()
     {
         Id = friendEntity.Id,
         FriendId = friendEntity.FriendId,
         UserId = friendEntity.UserId
     });
 }
예제 #4
0
        public void CreateFriendship(int userId, int friendId)
        {
            var friendship = new BllFriend()
            {
                FriendId = friendId, UserId = userId
            };

            FriendService.Create(friendship);

            var friendshipFromDb =
                FriendService.GetAll()
                .FirstOrDefault(fs => fs.UserId == userId && fs.FriendId == friendId);

            Assert.AreEqual(friendshipFromDb.FriendId, friendId);
        }