예제 #1
0
        public IHttpActionResult Get([FromUri] SearchPhotoAlbumModel searchPhotoAlbumModel)
        {
            IEnumerable <PhotoAlbum> photoAlbums = null;
            int countAlbums = 0;

            if (searchPhotoAlbumModel == null)
            {
                photoAlbums = _photoAlbumService.GetAll();
                countAlbums = _photoAlbumService.GetAll().Count();
            }
            else
            {
                countAlbums = _photoAlbumService.SearchPhotoAlbum(searchPhotoAlbumModel).Count();
                photoAlbums = _photoAlbumService.SearchPhotoAlbum(searchPhotoAlbumModel).Pagination((searchPhotoAlbumModel.Page - 1) * searchPhotoAlbumModel.Size, searchPhotoAlbumModel.Size).ToList();
            }

            var photoAlbumViewModels = Mapper.Map <IEnumerable <PhotoAlbum>, IEnumerable <PhotoAlbumWithImagesViewModel> >(photoAlbums);

            return(Ok(new
            {
                Items = photoAlbumViewModels,
                TotalCount = countAlbums
            }));
        }
        public void GetAll_NoAlbumsOrPhotos_ReturnsEmptyList()
        {
            _mockPhotoRepository.GetAll().Returns(new List <PhotoDto>());
            _mockAlbumRepository.GetAll().Returns(new List <AlbumDto>());
            var result = _service.GetAll();

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Count());
            _mockPhotoRepository.Received(1).GetAll();
            _mockAlbumRepository.Received(1).GetAll();
        }
 public static IList <Model.PhotoAlbum> GetAll(Guid userId)
 {
     return(instance.GetAll(userId));
 }
예제 #4
0
 public IEnumerable <PhotoAlbum> Get()
 {
     return(_photoAlbumService.GetAll());
 }