public async Task <ActionResult> Get(string search = null)
        {
            DateTime utcNow   = DateTime.UtcNow;
            DateTime now      = TimeZoneInfo.ConvertTimeFromUtc(utcNow, _timeZone);
            DateTime dateFrom = now.AddMonths(-1);

            RigaBuildingPermit[] buildingPermits = await _repository.GetBuildingPermits(dateFrom, search);

            string title = "Rīgas būvatļaujas";

            if (!string.IsNullOrEmpty(search))
            {
                title += $" - {search}";
            }

            SyndicationFeed feed = new SyndicationFeed(title, null, new Uri(RigaBuildingPermitRepository.BaseUrl));

            try
            {
                feed.Items = buildingPermits
                             .Select(buildingPermit => CreateSyndicationItem(buildingPermit))
                             .ToArray();
            }
            catch (Exception e)
            {
                FeedHelper.AddExceptionToFeed(feed, e);
            }

            return(new FeedActionResult(feed));
        }
        public async Task <ActionResult> Get()
        {
            SyndicationFeed feed = new SyndicationFeed("Satiksmes ministrijas izstrādē esošie attīstības plānošanas dokumenti un tiesību akti", null, TransportProjectRepository.BaseUrl);

            try
            {
                TransportProject[] transportProjects = await _repository.GetTransportProjects();

                feed.Items = transportProjects
                             .Select(transportProject => CreateSyndicationItem(transportProject))
                             .ToArray();
            }
            catch (Exception e)
            {
                FeedHelper.AddExceptionToFeed(feed, e);
            }

            return(new FeedActionResult(feed));
        }
Пример #3
0
        public async Task <ActionResult> Get()
        {
            SyndicationFeed feed = new SyndicationFeed("Zemkopības ministrijas sabiedriskās apspriešanas", null, AgricultureProjectRepository.BaseUrl);

            try
            {
                AgricultureProject[] agricultureProjects = await _repository.GetAgricultureProjects();

                feed.Items = agricultureProjects
                             .Select(agricultureProject => CreateSyndicationItem(agricultureProject))
                             .ToArray();
            }
            catch (Exception e)
            {
                FeedHelper.AddExceptionToFeed(feed, e);
            }

            return(new FeedActionResult(feed));
        }