Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
How can i save requests from form to DB for this http://carlosmartinezt.com/2014/06/umbraco-7-and-mvc-contact-form/ ?
After sending email, write code to save data to database. Here is an example, paste following after SendMail() function.
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString); con.Open(); SqlDataAdapter sda = new SqlDataAdapter("SaveEnquiry", con); sda.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add(new SqlParameter("@Name", Model.FullName)); sda.SelectCommand.Parameters.Add(new SqlParameter("@Email", Model.Email)); sda.SelectCommand.Parameters.Add(new SqlParameter("@Telephone", Model.Telephone)); sda.SelectCommand.Parameters.Add(new SqlParameter("@Comments", Model.Comments)); sda.SelectCommand.ExecuteNonQuery(); sda.Dispose(); con.Close();
You will need to write Stored Procedure in SQL database to handle this transaction. Or you can also write inline INSERT statement.
Here is cleaner version of above code:
But, how can I use umbraco admin interface for reading this entries?
You have a couple of options:
This is not easy process, may be. Umbraco has ready api for this ?
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Contact Form Save to DB
How can i save requests from form to DB for this http://carlosmartinezt.com/2014/06/umbraco-7-and-mvc-contact-form/ ?
After sending email, write code to save data to database. Here is an example, paste following after SendMail() function.
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString); con.Open(); SqlDataAdapter sda = new SqlDataAdapter("SaveEnquiry", con); sda.SelectCommand.CommandType = System.Data.CommandType.StoredProcedure; sda.SelectCommand.Parameters.Add(new SqlParameter("@Name", Model.FullName)); sda.SelectCommand.Parameters.Add(new SqlParameter("@Email", Model.Email)); sda.SelectCommand.Parameters.Add(new SqlParameter("@Telephone", Model.Telephone)); sda.SelectCommand.Parameters.Add(new SqlParameter("@Comments", Model.Comments)); sda.SelectCommand.ExecuteNonQuery(); sda.Dispose(); con.Close();
You will need to write Stored Procedure in SQL database to handle this transaction. Or you can also write inline INSERT statement.
Here is cleaner version of above code:
But, how can I use umbraco admin interface for reading this entries?
You have a couple of options:
This is not easy process, may be. Umbraco has ready api for this ?
is working on a reply...