/// <summary> /// ctor the Mighty /// </summary> public BrewSessionCommentEmailMessage(IWebSettings webSettings, BrewSession brewSession, string commenterUsername, UserSummary userToNotify, BrewSessionComment brewSessionComment, BrewgrUrlBuilder brewgrUrlBuilder) : base(webSettings) { this.WebSettings = webSettings; this.BrewSession = brewSession; this.CommenterUsername = commenterUsername; this.UserToNotify = userToNotify; this.BrewSessionComment = brewSessionComment; this.BrewgrUrlBuilder = brewgrUrlBuilder; // Set Sender this.SenderAddress = webSettings.SenderAddress; this.SenderDisplayName = webSettings.SenderDisplayName; // Set Recipient this.ToRecipients.Add(userToNotify.EmailAddress); // Build Subject if (brewSession.UserId == userToNotify.UserId) { this.Subject = string.Format("{0} commented on your brew session for {1}", commenterUsername, brewSession.RecipeSummary.RecipeName); } else { this.Subject = string.Format("{0} also left a comment on the brew session for {1}", commenterUsername, brewSession.RecipeSummary.RecipeName); } }
/// <summary> /// Builds a Recipe Detail Url /// </summary> public string BuildBrewSessionDetailUrl(BrewSession brewSession) { var brewSessionNameForUrl = StringCleaner.CleanForUrl(brewSession.RecipeSummary.RecipeName); brewSessionNameForUrl += "-brew-session"; return(string.Format("/brew/{0}/{1}", brewSession.BrewSessionId, brewSessionNameForUrl)); }
/// <summary> /// Builds a Recipe Detail Url /// </summary> public string BuildBrewSessionDetailUrl(BrewSession brewSession) { var brewSessionNameForUrl = StringCleaner.CleanForUrl(brewSession.RecipeSummary.RecipeName); brewSessionNameForUrl += "-brew-session"; return(string.Format("{0}/brew/{1}/{2}", this.WebSettings.RootPath, brewSession.BrewSessionId, brewSessionNameForUrl)); }
/// <summary> /// Verifies Recipe Brew Access /// </summary> bool VerifyBrewSessionAccess(BrewSession brewSession) { if (brewSession == null || !brewSession.WasBrewedBy(this.ActiveUser.UserId)) { return false; } return true; }
/// <summary> /// Builds a Recipe Detail Url /// </summary> public string BuildBrewSessionDetailUrl(BrewSession brewSession) { var brewSessionNameForUrl = StringCleaner.CleanForUrl(brewSession.RecipeSummary.RecipeName); brewSessionNameForUrl += "-brew-session"; return string.Format("{0}/brew/{1}/{2}", this.WebSettings.RootPath, brewSession.BrewSessionId, brewSessionNameForUrl); }