Exemple #1
0
        public ActionResult ContactUs(ContactUs contactus)
        {
            try
            {
                ContactUs objsbContactUs = new ContactUs();
                objsbContactUs.Name     = contactus.Name;
                objsbContactUs.EmailId  = contactus.EmailId;
                objsbContactUs.Subject  = contactus.Subject;
                objsbContactUs.Comments = contactus.Comments;

                bool IsInserted = false;
                IsInserted = objsbContactUs.AddSb_ContactUs(); //add contacts in database
                if (IsInserted)
                {
                    ViewBag.Message = "We will contact with you shortly";
                }
            }
            catch (Exception ee)
            {
                ViewBag.Message = "Error occurred";
            }
            //Empty Controls
            ModelState.Clear();
            ModelState.Remove("Name");
            contactus.Name = "";
            ModelState.Remove("EmailId");
            contactus.EmailId = "";
            ModelState.Remove("Subject");
            contactus.Subject = "";
            ModelState.Remove("Comments");
            contactus.Comments = "";
            return(View(contactus));
        }