Exemplo n.º 1
0
        public async Task <ActionResult <List <PodcastViewModel> > > Get()
        {
            var podcasts = await _repository
                           .GetAllForUserAsync(_applicationUser.Id);

            var ret = _mapper.Map <List <Podcast>, List <PodcastViewModel> >(podcasts.ToList());

            return(Ok(ret));
        }
        public int Resolve(ApplicationUser source, ProfileViewModel destination, int destMember,
                           ResolutionContext context)
        {
            var results = AsyncHelper.RunSync(() => _podcastRepository.GetAllForUserAsync(source.Id));

            return(results.Count());
        }
        public async Task <ActionResult <List <BrowserExtensionPodcastViewModel> > > Get()
        {
            var podcasts = await _podcastRepository
                           .GetAllForUserAsync(_applicationUser.Id);

            var ret = podcasts
                      .Select(r => new BrowserExtensionPodcastViewModel {
                Id       = r.Id.ToString(),
                Title    = r.Title.ToString(),
                ImageUrl = r.GetImageUrl(
                    _options.GetSection("StorageSettings")["ImageUrl"],
                    _options.GetSection("ImageFileStorageSettings")["ContainerName"])
            });

            return(Ok(ret));
        }
Exemplo n.º 4
0
        public static async Task <string> GetOpmlFeed(this ApplicationUser user, IPodcastRepository repository, string rssUrl, string siteUrl)
        {
            var podcasts = await repository.GetAllForUserAsync(user.Id);

            var xml = await ResourceReader.ReadResource("opml.xml");

            var template = Handlebars.Compile(xml);
            var model    = new {
                title = $"PodNoms OPML feed for {user.GetBestGuessName()}",
                items = podcasts.Select(p => new {
                    title   = p.Title,
                    rssUrl  = p.GetRssUrl(rssUrl),
                    siteUrl = siteUrl
                })
            };
            var result = template(model);

            return(result);
        }