public IActionResult Index() { VerseBusinessService vbs = new VerseBusinessService(); List <BibleVerse> verses = vbs.getAllVerses(); return(View("Views/Verse/Index.cshtml", verses)); }
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()); } }
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)); } }
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)); } }
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()); } }