Ejemplo n.º 1
0
        public static MvcHtmlString ActionSiteLink(this HtmlHelper helper, int siteID)
        {
            string siteName = "";

            using (SiteContext context = new SiteContext())
            {
                // Няма избран сайт
                if (siteID == 0)
                {
                    int id = context.GetMainSiteID();
                    HttpSession.CurrentSiteID = id;
                    // Взема име на сайта
                    siteName = context.GetSiteName(id);
                }
                else
                {
                    // Взема име на сайта
                    siteName = context.GetSiteName(siteID);
                }
            }
            return(Html.LinkExtensions.ActionLink(
                       helper,
                       siteName,
                       "Index", "Site", new { area = "Admin" }, null));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Взема ID на главния сайт
        /// </summary>
        /// <returns></returns>
        public static int GetMainSiteID()
        {
            int siteID = 0;

            using (SiteContext context = new SiteContext())
            {
                siteID = context.GetMainSiteID();
            }
            return(siteID);
        }