public bool ReportAbuse(string snippetId) { using (busCodeSnippet busSnippet = new busCodeSnippet()) { if (busSnippet.Load(snippetId) == null) { throw new ArgumentException("Invalid snippetId passed."); } var snippet = busSnippet.Entity; // switch value snippet.IsAbuse = !snippet.IsAbuse; if (snippet.IsAbuse) { AppWebUtils.SendEmail("CodePaste.NET Abuse: " + busSnippet.Entity.Title, "Abuse reported for this snippet \r\n\r\n" + WebUtils.ResolveServerUrl("~/" + busSnippet.Entity.Id), App.Configuration.AdminEmailAddress); } if (!busSnippet.Save()) { throw new ApplicationException(busSnippet.ErrorMessage); } return(snippet.IsAbuse); } }
/// <summary> /// Sends email using the WebStoreConfig Email Configuration defaults. /// <seealso>Class WebUtils</seealso> /// </summary> /// <param name="Subject"> /// The subject of the message. /// </param> /// <param name="Message"> /// The body of the message. /// </param> /// <param name="Recipient"> /// The recipient as an email address. /// </param> /// <param name="Boolean SendAsText"> /// Determines whether the message is sent as Text or HTML. /// </param> /// <returns>Boolean</returns> public static bool SendEmail(string Subject, string Message, string Recipient, bool SendAsText) { return(AppWebUtils.SendEmail(Subject, Message, Recipient, null, null, false, SendAsText, null)); }