public void FeedbackForm(FeedbackFormModel feedbackFormModel) { using (var context = new SiteContainer()) { var emails = new List<MailAddress> { new MailAddress("*****@*****.**") }; var responseData = Helpers.MailHelper.SendTemplate(null, emails, "Форма обратной связи", null, null, true, feedbackFormModel.Name, feedbackFormModel.Email, feedbackFormModel.Text); var responseFeedback = new Feedback { Email = feedbackFormModel.Email, ErrorMessage = responseData.ErrorMessage, Text = feedbackFormModel.Text, Title = feedbackFormModel.Name, Sent = responseData.EmailSent }; context.AddToFeedback(responseFeedback); context.SaveChanges(); } }
/// <summary> /// Create a new Feedback object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="text">Initial value of the Text property.</param> /// <param name="title">Initial value of the Title property.</param> /// <param name="sent">Initial value of the Sent property.</param> public static Feedback CreateFeedback(global::System.Int32 id, global::System.String text, global::System.String title, global::System.Boolean sent) { Feedback feedback = new Feedback(); feedback.Id = id; feedback.Text = text; feedback.Title = title; feedback.Sent = sent; return feedback; }
/// <summary> /// Deprecated Method for adding a new object to the Feedback EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToFeedback(Feedback feedback) { base.AddObject("Feedback", feedback); }