예제 #1
0
        public IActionResult Index()
        {
            VerseBusinessService vbs    = new VerseBusinessService();
            List <BibleVerse>    verses = vbs.getAllVerses();

            return(View("Views/Verse/Index.cshtml", verses));
        }
예제 #2
0
        public ActionResult CreateVerse(VerseModel v)
        {
            logger.Info("Entering VerseController.CreateVerse() with " + v);
            if (ModelState.IsValid)
            {
                VerseBusinessService bs = new VerseBusinessService();
                bool   result           = bs.CreateVerse(v);
                string message;
                if (result)
                {
                    message = "Verse successfully inserted";
                }
                else
                {
                    message = "Verse insertion failed.";
                }

                logger.Info("Exiting VerseController.CreateVerse() with " + message);
                return(View("Index"));
            }
            else
            {
                return(View());
            }
        }
예제 #3
0
        public IActionResult AddVerse(BibleVerse bv)
        {
            VerseBusinessService vbs = new VerseBusinessService();

            if (vbs.createVerse(bv))
            {
                return(Index());
            }
            else
            {
                ErrorViewModel ev = new ErrorViewModel();
                ev.RequestId = "Verse creation failed";
                return(View("Views/Shared/Error.cshtml", ev));
            }
        }
예제 #4
0
        public IActionResult FindVerse(BibleVerse bv)
        {
            VerseBusinessService vbs = new VerseBusinessService();

            if (vbs.findVerse(bv) == null)
            {
                ErrorViewModel ev = new ErrorViewModel();
                ev.RequestId = "No verse found";
                return(View("Views/Shared/Error.cshtml", ev));
            }
            else
            {
                BibleVerse bibleV = vbs.findVerse(bv);
                return(View("Views/Verse/SearchResults.cshtml", bibleV));
            }
        }
예제 #5
0
        public ActionResult SearchVerse(VerseModel v)
        {
            logger.Info("Entering VerseController.SearchVerse() with " + v);
            if (ModelState.IsValid)
            {
                VerseBusinessService bs     = new VerseBusinessService();
                VerseModel           result = bs.SearchVerse(v);

                logger.Info("Exiting VerseController.OnSearchVerse() with " + result);
                return(View("~/Views/Verse/SearchResult.cshtml", result));
            }
            else
            {
                return(View());
            }
        }