public ActionResult ContactUs(ContactUsInput input) { // Validate the model being submitted if (!ModelState.IsValid) { // If the incoming request is an Ajax Request // then we just return a partial view (snippet) of HTML // instead of the full page if (Request.IsAjaxRequest()) { return(PartialView("_ContactUs", input)); } return(View(input)); } // TODO: A real app would send some sort of email here if (Request.IsAjaxRequest()) { // Same idea as above return(PartialView("_ThanksForFeedback", input)); } // A standard (non-Ajax) HTTP Post came in // set TempData and redirect the user back to the Home page TempData["Message"] = string.Format("Thanks for the feedback, {0}! We will contact you shortly.", input.Name); return(RedirectToAction("Index")); }
public ActionResult ContactUs(ContactUsInput input) { // Validate the model being submitted if (!ModelState.IsValid) { // If the incoming request is an Ajax Request // then we just return a partial view (snippet) of HTML // instead of the full page if (Request.IsAjaxRequest()) { return(PartialView("_ContactUs", input)); } return(View(input)); } // TODO: A real app would send some sort of email here if (Request.IsAjaxRequest()) { // Same idea as above ContactUsInput contact = new ContactUsInput(); contact.Create(UserModel.CurrentUserId, input.Message); return(PartialView("_ThanksForFeedback", input)); } // A standard (non-Ajax) HTTP Post came in // set TempData and redirect the user back to the Home page //TempData["Message"] = string.Format("Thanks for the feedback, {0}! We will contact you shortly.", input.Name); TempData["Message"] = string.Format("Сообщение отправлено! Мы постараемся оперативно ответить на Ваш вопрос."); return(RedirectToAction("Index")); }