public ActionResult CreateSiteMap(HttpContextBase httpContext, IEnumerable <SiteMapNodeModel> siteMapNodes) { if (httpContext == null) { throw new ArgumentNullException("httpContext"); } string baseUrl = baseUrlProvider.GetBaseUrl(httpContext); List <SiteMapNodeModel> nodeList = siteMapNodes != null?siteMapNodes.ToList() : new List <SiteMapNodeModel>(); IEnumerable <XmlSerializerNamespaceModel> namespaces = xmlNamespaceProvider.GetNamespaces(nodeList); return(CreateSitemapInternal(baseUrl, nodeList, namespaces)); }
public MainPageViewModel(IBaseUrlProvider baseUrlProvider) { PageLoadedCommand = new DelegateCommand(PageLoadCompleted); ToggleBoldCommand = new DelegateCommand(ToggleBold); _baseUrlProvider = baseUrlProvider; EditorContent = string.Format("{0}/Editor/editor.html", _baseUrlProvider.GetBaseUrl()); }
public void ReturnsExpectedGetBaseUrl(string baseUrl, string expectedBaseUrl) { _baseUrlProvider.GetBaseUrl().Returns(baseUrl); var result = _serviceEndpointsProvider.GetBaseUrl(); _baseUrlProvider.Received().GetBaseUrl(); result.ShouldBe(expectedBaseUrl); }
public void ValidateUrls(HttpContextBase httpContext, object item) { if (item == null) { throw new ArgumentNullException("item"); } UrlPropertyModel urlPropertyModel = GetPropertyModel(item.GetType()); Lazy <string> baseUrlProvider = new Lazy <string>(() => _baseUrlProvider.GetBaseUrl(httpContext)); foreach (PropertyInfo urlProperty in urlPropertyModel.UrlProperties) { CheckForAbsoluteUrl(item, urlProperty, baseUrlProvider); } foreach (PropertyInfo classProperty in urlPropertyModel.ClassProperties) { object value = classProperty.GetValue(item, null); if (value != null) { ValidateUrls(httpContext, value); } } foreach (PropertyInfo enumerableProperty in urlPropertyModel.EnumerableProperties) { IEnumerable value = enumerableProperty.GetValue(item, null) as IEnumerable; if (value != null) { foreach (object obj in value) { ValidateUrls(httpContext, obj); } } } }
public void Handle(PasswordResetTokenCreated @event) { var user = _readOnlyRepository.GetById <UserEmailLogin>(@event.UserId); _emailSender.Send(user.Email, new PasswordResetEmail(_baseUrlProvider.GetBaseUrl(), @event.TokenId)); }
public string GetBaseUrl() { return(_baseUrlProvider.GetBaseUrl()); }