示例#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));
        }
示例#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));
        }
示例#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());
        }
示例#4
0
 public Feed GetFeed(System.Int32 FeedId)
 {
     return(_iFeedRepository.GetFeed(FeedId));
 }
示例#5
0
 public List <FeedEvent> GetFeed(User user)
 {
     return(_feedRepository.GetFeed(user.UserID, MaxFeedCount));
 }
示例#6
0
 public async Task <List <FeedEvent> > GetFeed(User user)
 {
     return(await _feedRepository.GetFeed(user.UserID, MaxFeedCount));
 }