Exemplo n.º 1
0
        protected virtual List <RouteSegment> BuildRoute(string routeUrl)
        {
            if (!CaseSensitive)
            {
                routeUrl = routeUrl.ToLowerInvariant();
            }

            List <RouteSegment> result = new List <RouteSegment>();

            int lastIndex = 0;

            TokenParser.OnParsedToken += (sender, e) =>
            {
                if (e.StartPosition > lastIndex)
                {
                    result.Add(new StaticRouteSegment(routeUrl.Substring(lastIndex, e.StartPosition - lastIndex)));
                }

                result.Add(new ParamRouteSegment(ParameterService.Get(e.Token.Fullname)));
                lastIndex = e.EndPosition + 1;
            };

            if (!TokenParser.Parse(routeUrl))
            {
                throw Ensure.Exception.ArgumentOutOfRange("routeUrl", "Route url is not valid format for TokenRoute.");
            }

            if (routeUrl.Length > lastIndex)
            {
                result.Add(new StaticRouteSegment(routeUrl.Substring(lastIndex)));
            }

            return(result);
        }
Exemplo n.º 2
0
        public PartialViewResult SiteTitle()
        {
            var model = new HomeModel();

            try
            {
                model.SiteTitle = ParameterService.Get("SiteHeader").Value;
            }
            catch (Exception e)
            {
                Logger.Error("Hata oluştu - " + new StackTrace().GetFrame(0).GetMethod().Name, e);
            }
            return(PartialView(model));
        }