예제 #1
0
        public IPagedResponse <MediaModel> Get([FromUri] PagingFilter filter)
        {
            if (filter == null)
            {
                filter = new PagingFilter(1, 25);
            }

            var userId = this.getUserId();

            IPagedResponse <IMedia> results = Business.Media.Media.GetMedia(userId, filter.Page, filter.Size);

            ICollection <MediaModel> models = new List <MediaModel>();

            if (results.Data != null)
            {
                foreach (IMedia a in results.Data)
                {
                    var model = MediaModel.Load(a);
                    models.Add(model);
                }
            }

            return(new PagedResponse <MediaModel>()
            {
                TotalCount = results.TotalCount,
                Data = models
            });
        }
예제 #2
0
        public MediaModel GetMediaByAssetId(int assetId)
        {
            IMedia     result = Business.Media.Media.GetMediaByAssetId(assetId);
            MediaModel media  = MediaModel.Load(result);

            return(media);
        }