You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FeedBusiness.cs 823B

12345678910111213141516171819202122232425262728
  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using Luticate2.Utils.Dbo.Result;
  4. using Microsoft.Extensions.Options;
  5. using WebApiWebSem.DataAccess;
  6. using WebApiWebSem.Dbo;
  7. using WebApiWebSem.Dbo.Feed;
  8. namespace WebApiWebSem.Business
  9. {
  10. public class FeedBusiness
  11. {
  12. private readonly AppConfigDbo _options;
  13. private readonly FeedDataAccess _feedDataAccess;
  14. public FeedBusiness(IOptions<AppConfigDbo> options, FeedDataAccess feedDataAccess)
  15. {
  16. _options = options.Value;
  17. _feedDataAccess = feedDataAccess;
  18. }
  19. public LuResult<IList<FeedDbo>> Get()
  20. {
  21. var feed = _feedDataAccess.Parse(_options.FeedUrl);
  22. return feed.To(dbos => (IList<FeedDbo>)dbos.Take(10).ToList());
  23. }
  24. }
  25. }