public ActionResult <AuthorFact> Get(Guid id)
        {
            var item = _authorFactService.AsQueryable()
                       .Where(x => x.Id == id)
                       .FirstOrDefault();

            if (item is null)
            {
                return(NoContent());
            }

            return(Ok(item));
        }
Esempio n. 2
0
        public ActionResult <object> Get(Guid id)
        {
            var rnd   = new Random();
            var facts = new List <EntityBase>();

            var authorFacts = _authorFactService
                              .AsQueryable()
                              .ToList();

            var bookFacts = _bookFactService
                            .AsQueryable()
                            .ToList();

            facts.AddRange(authorFacts);
            facts.AddRange(bookFacts);

            facts.Shuffle();

            var rndFact = facts[rnd.Next(0, facts.Count - 1)];

            return(Ok(rndFact));
        }