public ActionResult Hash(Guid?faqId, Guid?categoryId, Guid?subcategoryId, string keywords) { // Faq. if (faqId != null) { var faq = _faqsQuery.GetFaq(faqId.Value); if (faq != null) { var url = faq.GenerateUrl(_faqsQuery.GetCategories()).AsNonReadOnly(); if (!string.IsNullOrEmpty(keywords)) { url.QueryString["keywords"] = keywords; } return(RedirectToUrl(url)); } } // Subcategory. if (subcategoryId != null) { var subcategory = _faqsQuery.GetSubcategory(subcategoryId.Value); if (subcategory != null) { return(RedirectToUrl(subcategory.GenerateUrl())); } } // Search. if (!string.IsNullOrEmpty(keywords)) { return(RedirectToRoute(FaqsRoutes.Search, new { categoryId, keywords })); } // If nothing then redirect to the faqs page. return(RedirectToRoute(FaqsRoutes.Faqs)); }
public ActionResult SendContactUs(EmailUsModel emailUs) { try { emailUs.Prepare(); emailUs.Validate(); var subcategory = emailUs.SubcategoryId == null ? null : _faqsQuery.GetSubcategory(emailUs.SubcategoryId.Value); _emailsCommand.TrySend(new ContactUsEmail(emailUs.From, emailUs.Name, emailUs.UserType, emailUs.PhoneNumber, subcategory, emailUs.Message)); return(Json(new JsonResponseModel())); } catch (UserException ex) { ModelState.AddModelError(ex, new StandardErrorHandler()); } return(Json(new JsonResponseModel())); }