示例#1
0
        public ActionResult Search(VerseModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Search"));
            }
            VerseService  vs   = new VerseService(model);
            List <string> text = vs.SearchVerses();

            return(View("SearchResults", text));
        }
示例#2
0
        public ActionResult Insert(VerseModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            VerseService vs = new VerseService(model);

            vs.InsertVerse();
            return(View());
        }
示例#3
0
        public ActionResult Search(VerseModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("Index"));
            }

            VerseService  service = new VerseService(model);
            List <string> text    = service.SearchVerses();

            return(View("Results", text));
        }
示例#4
0
        public async Task <ActionResult <Passage> > GetPassageAsync(Books book, byte chapter, byte verse, [FromQuery] byte length = 1, [FromQuery] Translations translation = Translations.KJV)
        {
            if (chapter == 0 || verse == 0 || length == 0)
            {
                return(BadRequest());
            }

            var passageRef = new PassageReference(book, chapter, verse, length, 0, 0);
            var verses     = await VerseService.GetVersesAsync(passageRef.Verses, translation);

            return(Ok(verses));
        }
示例#5
0
        public ActionResult Insert(VerseModel model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Message = "This verse was already added previously!";
                return(View("Index"));
            }

            VerseService service = new VerseService(model);

            service.InsertVerse();
            ViewBag.Message = "You have added: " + model.Book + " " + model.Chapter + ":" + model.Verse + " to the app!";
            return(View("Index"));
        }