Exemple #1
0
        public async Task <ActionResult <MinBible> > GetBibles(string id)
        {
            var bible = await _context.Bibles.FindAsync(id);

            if (bible == null)
            {
                return(NotFound());
            }
            await _context.Entry(bible).Collection(b => b.BibleBooks).LoadAsync();

            _ = bible.HydrateBible();
            MinBible minBible = new MinBible(bible);

            return(minBible);
        }
Exemple #2
0
        public async Task <ActionResult <IEnumerable <MinBible> > > GetBibles()
        {
            try
            {
                List <Bible> BibleList = await _context.Bibles.Include(b => b.BibleBooks).ToListAsync();

                List <MinBible> minBibles = new List <MinBible>();
                foreach (Bible bible in BibleList)
                {
                    _ = bible.HydrateBible();
                    MinBible minBible = new MinBible(bible);
                    minBibles.Add(minBible);
                }
                return(minBibles);
            }
            catch { }
            return(null);
        }