public ActionResult Index(ContactUsPage currentPage) { var md = new ContactUsPageModel(currentPage); var locations = string.Empty; if (currentPage.OfficeItems != null && currentPage.OfficeItems.Items.Any()) { for (var i = 0; i < currentPage.OfficeItems.Items.Count; i++) { var item = currentPage.OfficeItems.Items[i]; var officeBlock = _icontentLoader.Get <OfficeBlock>(item.ContentLink); if (!Double.IsNaN(officeBlock.Latitude) && !officeBlock.Latitude.Equals(0) && !Double.IsNaN(officeBlock.Longitude) && !officeBlock.Longitude.Equals(0)) { var str = string.Format("['{0}',{1},{2},{3}]", HttpUtility.HtmlEncode(officeBlock.Address), officeBlock.Latitude, officeBlock.Longitude, i + 1); locations = !string.IsNullOrEmpty(locations) ? string.Format("{0},{1}", locations, str) : str; } } } md.Locations = string.Format("[{0}]", locations); if (currentPage != null && currentPage.ContactUsForm != null) { var urlResolver = ServiceLocator.Current.GetInstance <UrlResolver>(); var pageUrl = urlResolver.GetUrl(currentPage.ContentLink); var actionUrl = string.Format("{0}XFormPost/", pageUrl); actionUrl = UriSupport.AddQueryString(actionUrl, "XFormId", currentPage.ContactUsForm.Id.ToString()); actionUrl = UriSupport.AddQueryString(actionUrl, "failedAction", "Failed"); actionUrl = UriSupport.AddQueryString(actionUrl, "successAction", "Success"); actionUrl = UriSupport.AddQueryString(actionUrl, "contentId", currentPage.ContentLink.ID.ToString(CultureInfo.InvariantCulture)); md.ActionUrl = actionUrl; } ViewBag.Country = LocationHelpers.GetCountryCodeByIp(); var result = GetPhoneCodeByCountryCode(ViewBag.Country); ViewBag.PhoneCode = result.Data.phone; ViewBag.ListCountry = GetAllCountries(); return(View(md)); }
public ContactUs(HomePageModel homePage, ContactUsPageModel contactUsPage) { _homePage = homePage; _contactUsPage = contactUsPage; }