Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Commit

Permalink
Update #276 - Added MVC4 version of MVC Music Store as sample/test ap…
Browse files Browse the repository at this point in the history
…plication.
  • Loading branch information
nikmd23 committed Mar 11, 2013
1 parent 3921822 commit e0f0096
Show file tree
Hide file tree
Showing 102 changed files with 21,924 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Expand Up @@ -39,3 +39,11 @@ Help/
/source/Glimpse.AspNet.Net45/NuSpec/lib/net45/Glimpse.AspNet.dll

/source/Glimpse.AspNet.Net45/NuSpec/lib/net45/Glimpse.AspNet.pdb

/source/Glimpse.Mvc4.MusicStore.Sample/App_Data/ASPNETDB.MDF

/source/Glimpse.Mvc4.MusicStore.Sample/App_Data/ASPNETDB_log.ldf

/source/Glimpse.Mvc4.MusicStore.Sample/App_Data/MvcMusicStore.mdf

/source/Glimpse.Mvc4.MusicStore.Sample/App_Data/MvcMusicStore_log.ldf
13 changes: 13 additions & 0 deletions Glimpse.All.sln
Expand Up @@ -62,6 +62,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Glimpse.AspNet.Net45", "sou
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Glimpse.Mvc3", "source\Glimpse.Mvc3\Glimpse.Mvc3.csproj", "{585C1C27-8D37-4CB6-BD0F-464487845661}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Glimpse.Mvc4.MusicStore.Sample", "source\Glimpse.Mvc4.MusicStore.Sample\Glimpse.Mvc4.MusicStore.Sample.csproj", "{C2C38EE9-01B7-4929-B7E9-086077D1AB58}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -282,12 +284,23 @@ Global
{585C1C27-8D37-4CB6-BD0F-464487845661}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{585C1C27-8D37-4CB6-BD0F-464487845661}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{585C1C27-8D37-4CB6-BD0F-464487845661}.Release|x86.ActiveCfg = Release|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Debug|x86.ActiveCfg = Debug|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Release|Any CPU.Build.0 = Release|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C2C38EE9-01B7-4929-B7E9-086077D1AB58}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{32DCD27D-A84C-4250-B657-408B3620A9AC} = {CCFACE51-18FA-4C5D-9F89-EC58881786A9}
{C2C38EE9-01B7-4929-B7E9-086077D1AB58} = {CCFACE51-18FA-4C5D-9F89-EC58881786A9}
{9923BFBD-EA73-4719-A418-213003862550} = {A3097EAF-9D1B-416A-822E-F679D768BC55}
{76714E46-AFE9-49F0-AEE8-C8A966195914} = {A3097EAF-9D1B-416A-822E-F679D768BC55}
{FE12BC0C-CD22-4D24-BFC7-13ED1C428BAD} = {A3097EAF-9D1B-416A-822E-F679D768BC55}
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
39 changes: 39 additions & 0 deletions source/Glimpse.Mvc4.MusicStore.Sample/App_Start/AppConfig.cs
@@ -0,0 +1,39 @@
using MvcMusicStore.Filters;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using WebMatrix.WebData;

namespace MvcMusicStore
{
public static class AppConfig
{
public static void Configure()
{
System.Data.Entity.Database.SetInitializer(new MvcMusicStore.Models.SampleData());

CreateAdminUser();
}

private static void CreateAdminUser()
{
string _username = ConfigurationManager.AppSettings["DefaultAdminUsername"];
string _password = ConfigurationManager.AppSettings["DefaultAdminPassword"];
string _role = "Administrator";

new InitializeSimpleMembershipAttribute().OnActionExecuting(null);

if (!WebSecurity.UserExists(_username))
WebSecurity.CreateUserAndAccount(_username, _password);

if (!Roles.RoleExists(_role))
Roles.CreateRole(_role);

if (!Roles.IsUserInRole(_username, _role))
Roles.AddUserToRole(_username, _role);
}
}
}
32 changes: 32 additions & 0 deletions source/Glimpse.Mvc4.MusicStore.Sample/App_Start/AuthConfig.cs
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Web.WebPages.OAuth;
using MvcMusicStore.Models;

namespace MvcMusicStore
{
public static class AuthConfig
{
public static void RegisterAuth()
{
// To let users of this site log in using their accounts from other sites such as Microsoft, Facebook, and Twitter,
// you must update this site. For more information visit http://go.microsoft.com/fwlink/?LinkID=252166

//OAuthWebSecurity.RegisterMicrosoftClient(
// clientId: "",
// clientSecret: "");

//OAuthWebSecurity.RegisterTwitterClient(
// consumerKey: "",
// consumerSecret: "");

//OAuthWebSecurity.RegisterFacebookClient(
// appId: "",
// appSecret: "");

//OAuthWebSecurity.RegisterGoogleClient();
}
}
}
26 changes: 26 additions & 0 deletions source/Glimpse.Mvc4.MusicStore.Sample/App_Start/BundleConfig.cs
@@ -0,0 +1,26 @@
using System.Web;
using System.Web.Optimization;

namespace MvcMusicStore
{
public class BundleConfig
{
// For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));

// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));

bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
}
}
}
13 changes: 13 additions & 0 deletions source/Glimpse.Mvc4.MusicStore.Sample/App_Start/FilterConfig.cs
@@ -0,0 +1,13 @@
using System.Web;
using System.Web.Mvc;

namespace MvcMusicStore
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}
23 changes: 23 additions & 0 deletions source/Glimpse.Mvc4.MusicStore.Sample/App_Start/RouteConfig.cs
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace MvcMusicStore
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
19 changes: 19 additions & 0 deletions source/Glimpse.Mvc4.MusicStore.Sample/App_Start/WebApiConfig.cs
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;

namespace MvcMusicStore
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}

0 comments on commit e0f0096

Please sign in to comment.