public ActionResult <BookFact> Get(Guid id) { var item = _bookFactService.AsQueryable() .Where(x => x.Id == id) .FirstOrDefault(); if (item is null) { return(NoContent()); } return(Ok(item)); }
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)); }