Ejemplo n.º 1
0
 public IEnumerable <ImageDTO> GetImagesByUser(Guid userId)
 {
     if (userId == null)
     {
         throw new ArgumentNullException("user id is null");
     }
     try
     {
         usersDAL.GetUserById(userId);
     }
     catch (Exception e)
     {
         throw new ArgumentException("user id is incorrect, user doesn't exist", e);
     }
     return(imagesDAL.GetAllImages().Join(relationsDAL.GetImagesIdsByUserId(userId),
                                          image => image.Id, imageId => imageId, (image, imageId) => new ImageDTO
     {
         Id = imageId, DateOfCreating = image.DateOfCreating, Description = image.Description
     }));
 }
Ejemplo n.º 2
0
 public IEnumerable <ImageDTO> GetAllImages()
 {
     return(imagesDAL.GetAllImages());
 }