This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update #276 - Added MVC4 version of MVC Music Store as sample/test ap…
…plication.
- Loading branch information
Showing
102 changed files
with
21,924 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file added
BIN
+1 MB
source/Glimpse.Mvc4.MusicStore.Sample/App_Data/ASPNETDB_log_ReadOnly.ldf
Binary file not shown.
Binary file added
BIN
+3.06 MB
source/Glimpse.Mvc4.MusicStore.Sample/App_Data/MvcMusicStore_ReadOnly.mdf
Binary file not shown.
Binary file added
BIN
+1 MB
source/Glimpse.Mvc4.MusicStore.Sample/App_Data/MvcMusicStore_log_ReadOnly.ldf
Binary file not shown.
39 changes: 39 additions & 0 deletions
39
source/Glimpse.Mvc4.MusicStore.Sample/App_Start/AppConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
32
source/Glimpse.Mvc4.MusicStore.Sample/App_Start/AuthConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
26
source/Glimpse.Mvc4.MusicStore.Sample/App_Start/BundleConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
13
source/Glimpse.Mvc4.MusicStore.Sample/App_Start/FilterConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
23
source/Glimpse.Mvc4.MusicStore.Sample/App_Start/RouteConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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
19
source/Glimpse.Mvc4.MusicStore.Sample/App_Start/WebApiConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } | ||
); | ||
} | ||
} | ||
} |
Oops, something went wrong.