예제 #1
0
        public IActionResult Contactus(GetInTouch1 contact1)
        {
            ContactHandler handler        = new ContactHandler(_configuration);
            var            newGetInTouch1 = handler.AddGetInTouch1(contact1);

            //contact1.DateCreated = DateTime.Now;
            return(RedirectToAction("Listing"));
        }
예제 #2
0
        public object AddGetInTouch1(GetInTouch1 contact1)
        {
            DataAccess db = new DataAccess(_configuration);

            var contacts = db.AddGetInTouch1ToDatabase(contact1);

            return(contacts);
        }
예제 #3
0
        public object AddGetInTouch1ToDatabase(GetInTouch1 newGetInTouch1)
        {
            string queryString = "INSERT INTO GetInTouch(Name,Email,Contact,Message,DateCreated)Values('" + newGetInTouch1.Name + "','" + newGetInTouch1.Email + "','" + newGetInTouch1.Contact + "','" + newGetInTouch1.Message + "','" + newGetInTouch1.DateCreated + "');";

            using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.BlogConnectionStringValue(_configuration, ConnectionStringName)))
            {
                GetInTouch1[] contacts = connection.Query <GetInTouch1>(queryString).ToArray();
                return(contacts);
            }
        }