public static void SendEmail(Suggestion suggestion)
        {
            var appName = WebConfigurationManager.AppSettings["AppName"];
            var appUrl = WebConfigurationManager.AppSettings["AppUrl"];
            var smtpServer = WebConfigurationManager.AppSettings["SmtpServer"];
            var fromAddress = WebConfigurationManager.AppSettings["EmailFrom"];
            var toAddress = WebConfigurationManager.AppSettings["EmailTo"];

            var subject = string.Format("{0}: {1}", appName, suggestion.Title);
            var body = string.Format(@"""{0}""  has been submitted to {1}.

            ""{2}""

            You can view the suggestion here: {3}Suggestions/View/{4}", suggestion.Title, appName, suggestion.Body, appUrl, suggestion.Id);

            var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body
            };

            var client = new SmtpClient(smtpServer);

            client.Send(message);
        }
        public static void SendEmail(Suggestion suggestion)
        {
            var markdown = new Markdown();
            var appName = WebConfigurationManager.AppSettings["AppName"];
            var appUrl = WebConfigurationManager.AppSettings["AppUrl"];
            var smtpServer = WebConfigurationManager.AppSettings["SmtpServer"];
            var fromAddress = WebConfigurationManager.AppSettings["EmailFrom"];
            var toAddress = WebConfigurationManager.AppSettings["EmailTo"];

            var subject = string.Format("{0}: {1}", appName, suggestion.Title);
            var body = string.Format(@"<p>""{0}""  has been submitted to {1}.</p>
            {2}
            <p>You can view the suggestion <a href=""{3}Suggestions/View/{4}"">here</a>.</p>", suggestion.Title, appName, markdown.Transform(suggestion.Body), appUrl, suggestion.Id);

            var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body,
                IsBodyHtml = true
            };

            var client = new SmtpClient(smtpServer);

            client.Send(message);
        }
        private SuggestionModel ConvertSuggestionToModel(Suggestion suggestion)
        {
            var model = Mapper.Map<Suggestion, SuggestionModel>(suggestion);
            model.CanBeDeleted = UserIsAdmin && model.Status != SuggestionStatus.Deleted;
            model.CanBeApproved = UserIsAdmin && model.Status != SuggestionStatus.Approved;
            model.CanBeCompleted = UserIsAdmin && model.Status != SuggestionStatus.Completed;
            model.CanBeDenied = UserIsAdmin && model.Status != SuggestionStatus.Denied;

            model.Comments = model.Comments
                .Where(c => c.Status != CommentStatus.Deleted || UserIsAdmin)
                .Select(SetupComment)
                .OrderBy(c => c.Date).ToList();

            return model;
        }
 /// <summary>
 /// Create a new Suggestion object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="body">Initial value of the Body property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 public static Suggestion CreateSuggestion(global::System.Int32 id, global::System.String title, global::System.String body, global::System.DateTime date, global::System.Int32 status)
 {
     Suggestion suggestion = new Suggestion();
     suggestion.Id = id;
     suggestion.Title = title;
     suggestion.Body = body;
     suggestion.Date = date;
     suggestion.Status = status;
     return suggestion;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Suggestions EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToSuggestions(Suggestion suggestion)
 {
     base.AddObject("Suggestions", suggestion);
 }