//
        // GET: /Administrator/ DailyReading/
        public ActionResult Index()
        {
            CurrentDate = DateTime.Now;

            var timeOfTheDay = DateTime.Now.Hour;

            CurrentScriptures = _dailyReadingRepository.GetDailyScriptures();
            if (timeOfTheDay < 12)
            {
                ViewBag.TimeOfTheDay = 1;
                GetReading(CurrentScriptures.FirstReading, 1, CurrentDate);
            }
            else if (timeOfTheDay < 17)
            {
                ViewBag.TimeOfTheDay = 2;
                GetReading(CurrentScriptures.SecondReading, 2, CurrentDate);
            }
            else
            {
                ViewBag.TimeOfTheDay = 3;
                GetReading(CurrentScriptures.ThirdReading, 3, CurrentDate);
            }
            ViewBag.ReadingContent = ReadingContent ?? string.Empty;
            ViewBag.ReadingTitle   = ReadingTitle ?? string.Empty;
            return(View());
        }
Exemple #2
0
 public IHttpActionResult GetDailyReading(int dayOfTheYear)
 {
     try
     {
         var result = _bibleRepository.GetDailyScriptures(dayOfTheYear);
         return(Ok(result));
     }
     catch (Exception exception)
     {
         throw new InvalidOperationException("Unable to fetch bible passage", exception);
     }
 }