コード例 #1
0
ファイル: HomeController.cs プロジェクト: crew1248/web_store
        //public IConfigRepository config { get { return _conf; } private set { _conf = value; } }
        public async Task<ActionResult> Index(string userid = null, string codeAuth = null, string credentialToken = null, int style = 0)
        {

            IConfigRepository _conf = new ConfigRepository();
            IMenuRepository _mrepo = new MenuRepository();
            IProductRepository _mprod = new ProductRepository();
            ViewBag.FirstCat = _mprod.Products.Any() ? _mprod.Products.First().ID : 0;
            if (_conf.Options().SelectedIsOnlineID)
            {
                throw new HttpException(410, "Offline");
            }
            var user = await UserManager.FindByIdAsync(userid);            
            ViewBag.ConfirmEmail = userid != null && !User.Identity.IsAuthenticated && codeAuth == null ? true : false;
            ViewBag.SetPassword = userid != null && codeAuth != null ? true : false;
            ViewBag.UserName = userid != null && !User.Identity.IsAuthenticated ? user.UserName : "";
            ViewBag.UserId = userid != null && codeAuth != null ? userid : "";
            ViewBag.Code = codeAuth != null && userid != null ? codeAuth : "";
            ViewBag.Style = style;
            ViewBag.Token = credentialToken;
            ViewBag.Titlee = _conf.Options().SiteName;
            var result = _mrepo.Menues.FirstOrDefault(x => x.Url == "Home");
            return View(result);
        }
コード例 #2
0
 public static Config SiteOptions()
 {
     IConfigRepository conf = new ConfigRepository();
     var item = conf.Options();
     return item;
 }