主攻ASP.NET.4.5 MVC4.0の再生:Webサイトの外観と皮膚のインタフェースのスタイルを交換します

4670 ワード

CommonController---_Admin.cshtml
 1         SysUserRepository sysuserrepository = new SysUserRepository();

 2         public SysUser sysuser { get; set; }

 3         public string Css()

 4         {

 5             int sysuserid = int.Parse(CookieHelper.GetValue("SysUserID"));

 6             sysuser = sysuserrepository.GetModel(sysuserid);

 7             switch (sysuser.SkinColor)

 8             {

 9                 case 0: return "blue";

10                 case 1: return "green";

11                 case 2: return "brown";

12                 case 3: return "purple";

13                 case 4: return "red";

14                 case 5: return "greyblue";

15                 default: return "blue";

16             }

17         }
 <link id="color" rel="stylesheet" type="text/css" href="/Content/admin/css/colors/@{@Html.Action("Css","Common")}.css" />