Пример #1
0
        public ActionResult GetLink(string currentArea, string currentController, string currentAction, string currentLocale)
        {
            PEMRBACEntities rbacEntities = new PEMRBACEntities();
            HelpLinkModel   model        = null;

            Uri url     = Request.Url;
            var baseUrl = Request.IsLocal
                          ? String.Format("{0}://{1}:{2}", url.Scheme, url.Host, url.Port)
                          : String.Format("{0}://{1}", url.Scheme, url.Host);

            var helpMap = rbacEntities.HelpMaps.FirstOrDefault(x => x.Area == currentArea &&
                                                               x.Controller == currentController &&
                                                               x.Action == currentAction && x.CultureCode == currentLocale);

            if (helpMap != null)
            {
                model = new HelpLinkModel()
                {
                    Server = helpMap.Server == null ? baseUrl :
                             helpMap.Server.EndsWith("/") ? helpMap.Server.Remove(helpMap.Server.Length - 1) : helpMap.Server,
                    File  = helpMap.File.StartsWith("/") ? helpMap.File.Substring(1) : helpMap.File,
                    Topic = helpMap.Topic
                };
            }

            return(PartialView(model));
        }
Пример #2
0
 internal HelpLink(Api api, HelpLinkModel model)
 {
     _api        = api;
     Id          = model.Id;
     Text        = model.Text;
     Subtext     = model.Subtext;
     Url         = model.Url;
     AvailableTo = model.AvailableTo;
 }