public static void SaveSaintReflection(int saintId, string title, string content) { var service = new SaintReflectionService(); var saintReflection = new SaintReflection { SaintId = saintId, UserId = Auth.user().Id, Title = title, Content = content }; if (service.UserHasReflection(Auth.user().Id, saintId)) { service.Update(saintId, saintReflection); } else { service.Create(saintReflection); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DateTime readingDate; if (Request["date"] != null) { readingDate = Convert.ToDateTime(Request["date"]); } else { readingDate = DateTime.UtcNow; } var saints = getSaints(readingDate); SaintsID.Value = saints.Id.ToString(); SaintDate.InnerHtml = saints.PublicationDate.DayOfWeek + ", " + saints.PublicationDate.ToString("MMMM dd, yyyy"); FeaturedSaint.InnerHtml = saints.Name; FeastDay.InnerHtml = saints.FeastDay; PatronOf.InnerHtml = saints.Patron; BirthDate.InnerHtml = saints.BirthDate; DeathDate.InnerHtml = saints.DeathDate; SaintBio.InnerHtml = saints.Biography; CanonizedDate.InnerHtml = saints.CanonizeDate; ImagePath.Src = saints.ImagePath; DateTime VerseDate; if (Request["date"] != null) { VerseDate = Convert.ToDateTime(Request["date"]); } else { VerseDate = DateTime.UtcNow; } var verse = getVerse(VerseDate); BibleQuote.InnerHtml = verse.BibleVerseContent; BibleVerse.InnerHtml = verse.ChapterTitle; DateTime QuoteDate; if (Request["date"] != null) { QuoteDate = Convert.ToDateTime(Request["date"]); } else { QuoteDate = DateTime.UtcNow; } var quote = getQuote(QuoteDate); RelQuote.InnerHtml = quote.Quote; Author.InnerHtml = quote.Author; var service = new SaintReflectionService(); if (service.UserHasReflection(Auth.user().Id, Convert.ToInt32(saints.Id))) { var reflection = service.GetUserReflection(Auth.user().Id, Convert.ToInt32(saints.Id)); GReflectTitle.Value = reflection.Title; GReflectContent.Value = reflection.Content; } } }