Ejemplo n.º 1
0
        public FeedDTO GetFeed(string title, string publishDate)
        {
            var feed = feedCacheManager.Get(title);

            if (feed == null)
            {
                feed = feedRepository.GetFeed(title, publishDate);
                feedCacheManager.Set(title, feed);
            }
            return(Mapper.Map <FeedDTO>(feed));
        }
Ejemplo n.º 2
0
        public HttpResponseMessage Get(int id)
        {
            var f = feedRepository.GetFeed(id);

            if (f == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, string.Format("Feed with id {0} not found", id)));
            }
            return(Request.CreateResponse(f.Body));
        }
Ejemplo n.º 3
0
        public async Task <List <PublicationViewModel> > GetFeed(Guid userId, int amount, Guid?positionId, Guid?requestUserId)
        {
            if (amount <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(amount), "Amount must be greater than 0");
            }
            if (amount > MaxPublicationAmount)
            {
                throw new ArgumentOutOfRangeException(nameof(amount), $"Amount cannot be greater than {MaxPublicationAmount}");
            }

            if (!await UserService.Exists(userId))
            {
                throw new UserNotFoundException("User not found");
            }
            if (positionId.HasValue && !await PublicationService.Exists(positionId.Value))
            {
                throw new DataNotFoundException($"{positionId.Value.ToString()} does not exists.");
            }

            return((await FeedRepository.GetFeed(userId, amount, positionId, requestUserId)).ToList());
        }
Ejemplo n.º 4
0
 public Feed GetFeed(System.Int32 FeedId)
 {
     return(_iFeedRepository.GetFeed(FeedId));
 }
Ejemplo n.º 5
0
 public List <FeedEvent> GetFeed(User user)
 {
     return(_feedRepository.GetFeed(user.UserID, MaxFeedCount));
 }
Ejemplo n.º 6
0
 public async Task <List <FeedEvent> > GetFeed(User user)
 {
     return(await _feedRepository.GetFeed(user.UserID, MaxFeedCount));
 }