public IHttpActionResult Get(Guid id, [FromUri] PagingParameterModel paging)
        {
            var requestorId = GetRequestorId();
            var photos      =
                (_photoService.GetPhotosById(id, requestorId, PagingParameterViewModelAdapter.BuildPagingDto(paging))).Select(PhotoViewModelAdapter.BuildPhotoViewModel);

            int count = _photoService.Count(id, requestorId);
            var paginationMetadata = PaginationTool.SetPagination(paging, count);


            HttpContext.Current.Response.AddHeader("Access-Control-Expose-Headers", "Paging-Headers");
            HttpContext.Current.Response.Headers.Add("Paging-Headers", JsonConvert.SerializeObject(paginationMetadata));

            return(Ok(photos));
        }
示例#2
0
        public IActionResult Count()
        {
            var counter = _photoService.Count();

            return(Ok(counter));
        }