예제 #1
0
파일: ImagesBLL.cs 프로젝트: FR-MN/RGR
 public bool RemoveImageById(Guid imageId)
 {
     if (imageId == null)
     {
         throw new ArgumentNullException("image id is null");
     }
     foreach (var userId in relationsDAL.GetUsersIdsByImageId(imageId).ToArray())
     {
         relationsDAL.RemoveRelation(userId, imageId);
     }
     return(imagesDAL.RemoveImageById(imageId));
 }
예제 #2
0
파일: UsersBLL.cs 프로젝트: FR-MN/RGR
 public bool RemoveUserById(Guid userId)
 {
     if (userId == null)
     {
         throw new ArgumentNullException("user id is null");
     }
     foreach (var awardId in relationsDAL.GetImagesIdsByUserId(userId).ToArray())
     {
         relationsDAL.RemoveRelation(userId, awardId);
     }
     return(usersDAL.RemoveUserById(userId));
 }
예제 #3
0
 public bool RemoveImageFromUser(Guid userId, Guid imageId)
 {
     if (userId == null || imageId == null)
     {
         throw new ArgumentNullException("one of the relation ids are null");
     }
     if (!IsRelationExist(userId, imageId))
     {
         throw new ArgumentException("one of the ids are incorrect, user or award doesn't exist");
     }
     foreach (var user in GetUsersByImage(imageId))
     {
         if (user.Id == userId)
         {
             return(relationsDAL.RemoveRelation(userId, imageId));
         }
     }
     return(false);
 }