├── .gitattributes ├── .gitignore ├── MVCMusicStore ├── MVCMusicStore.Tests │ ├── App.config │ ├── Controllers │ │ └── HomeControllerTest.cs │ ├── MVCMusicStore.Tests.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── MVCMusicStore.sln └── MVCMusicStore │ ├── App_Data │ ├── MVCMusicStore.Models.StoreContext.mdf │ ├── MVCMusicStore.Models.StoreContext_log.ldf │ ├── aspnet-MVCMusicStore-20140623095615.mdf │ └── aspnet-MVCMusicStore-20140623095615_log.ldf │ ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ ├── IdentityConfig.cs │ ├── RouteConfig.cs │ └── Startup.Auth.cs │ ├── Content │ ├── Site.css │ ├── bootstrap.css │ └── bootstrap.min.css │ ├── Controllers │ ├── AccountController.cs │ ├── AlbumsController.cs │ ├── HomeController.cs │ └── ReviewsController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── MVCMusicStore.csproj │ ├── Models │ ├── AccountViewModels.cs │ ├── Album.cs │ ├── Artist.cs │ ├── IdentityModels.cs │ ├── Review.cs │ └── StoreContext.cs │ ├── Project_Readme.html │ ├── Properties │ └── AssemblyInfo.cs │ ├── Scripts │ ├── _references.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.10.2.intellisense.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-2.6.2.js │ ├── respond.js │ └── respond.min.js │ ├── Startup.cs │ ├── StoreDiagram.cd │ ├── Views │ ├── Account │ │ ├── ConfirmEmail.cshtml │ │ ├── ExternalLoginConfirmation.cshtml │ │ ├── ExternalLoginFailure.cshtml │ │ ├── ForgotPassword.cshtml │ │ ├── ForgotPasswordConfirmation.cshtml │ │ ├── Login.cshtml │ │ ├── Manage.cshtml │ │ ├── Register.cshtml │ │ ├── ResetPassword.cshtml │ │ ├── ResetPasswordConfirmation.cshtml │ │ ├── _ChangePasswordPartial.cshtml │ │ ├── _ExternalLoginsListPartial.cshtml │ │ ├── _RemoveAccountPartial.cshtml │ │ └── _SetPasswordPartial.cshtml │ ├── Albums │ │ ├── Create.cshtml │ │ ├── Delete.cshtml │ │ ├── Details.cshtml │ │ ├── Edit.cshtml │ │ └── Index.cshtml │ ├── Home │ │ ├── About.cshtml │ │ ├── Contact.cshtml │ │ └── Index.cshtml │ ├── Reviews │ │ ├── Create.cshtml │ │ ├── Delete.cshtml │ │ ├── Details.cshtml │ │ ├── Edit.cshtml │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _Layout.cshtml │ │ └── _LoginPartial.cshtml │ ├── Web.config │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff │ └── packages.config ├── Module 1 - Basics of MVC └── readme.txt ├── Module 2 - Models in MVC ├── MVCMusicStore.Tests │ ├── App.config │ ├── Controllers │ │ └── HomeControllerTest.cs │ ├── MVCMusicStore.Tests.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── MVCMusicStore.sln ├── MVCMusicStore │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ ├── IdentityConfig.cs │ │ ├── RouteConfig.cs │ │ └── Startup.Auth.cs │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ ├── Controllers │ │ ├── AccountController.cs │ │ ├── HomeController.cs │ │ └── ReviewsController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── MVCMusicStore.csproj │ ├── Models │ │ ├── AccountViewModels.cs │ │ ├── Album.cs │ │ ├── Artist.cs │ │ ├── IdentityModels.cs │ │ ├── Review.cs │ │ └── StoreContext.cs │ ├── Project_Readme.html │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.6.2.js │ │ ├── respond.js │ │ └── respond.min.js │ ├── Startup.cs │ ├── StoreDiagram.cd │ ├── Views │ │ ├── Account │ │ │ ├── ConfirmEmail.cshtml │ │ │ ├── ExternalLoginConfirmation.cshtml │ │ │ ├── ExternalLoginFailure.cshtml │ │ │ ├── ForgotPassword.cshtml │ │ │ ├── ForgotPasswordConfirmation.cshtml │ │ │ ├── Login.cshtml │ │ │ ├── Manage.cshtml │ │ │ ├── Register.cshtml │ │ │ ├── ResetPassword.cshtml │ │ │ ├── ResetPasswordConfirmation.cshtml │ │ │ ├── _ChangePasswordPartial.cshtml │ │ │ ├── _ExternalLoginsListPartial.cshtml │ │ │ ├── _RemoveAccountPartial.cshtml │ │ │ └── _SetPasswordPartial.cshtml │ │ ├── Albums │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Reviews │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _LoginPartial.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── packages.config └── readme.txt ├── Module 3 - Visual Studio tools ├── MVCMusicStore.Tests │ ├── App.config │ ├── Controllers │ │ └── HomeControllerTest.cs │ ├── MVCMusicStore.Tests.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── MVCMusicStore.sln ├── MVCMusicStore │ ├── App_Data │ │ ├── MVCMusicStore.Models.StoreContext.mdf │ │ └── MVCMusicStore.Models.StoreContext_log.ldf │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ ├── IdentityConfig.cs │ │ ├── RouteConfig.cs │ │ └── Startup.Auth.cs │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ ├── Controllers │ │ ├── AccountController.cs │ │ ├── AlbumsController.cs │ │ ├── HomeController.cs │ │ └── ReviewsController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── MVCMusicStore.csproj │ ├── Models │ │ ├── AccountViewModels.cs │ │ ├── Album.cs │ │ ├── Artist.cs │ │ ├── IdentityModels.cs │ │ ├── Review.cs │ │ └── StoreContext.cs │ ├── Project_Readme.html │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.6.2.js │ │ ├── respond.js │ │ └── respond.min.js │ ├── Startup.cs │ ├── StoreDiagram.cd │ ├── Views │ │ ├── Account │ │ │ ├── ConfirmEmail.cshtml │ │ │ ├── ExternalLoginConfirmation.cshtml │ │ │ ├── ExternalLoginFailure.cshtml │ │ │ ├── ForgotPassword.cshtml │ │ │ ├── ForgotPasswordConfirmation.cshtml │ │ │ ├── Login.cshtml │ │ │ ├── Manage.cshtml │ │ │ ├── Register.cshtml │ │ │ ├── ResetPassword.cshtml │ │ │ ├── ResetPasswordConfirmation.cshtml │ │ │ ├── _ChangePasswordPartial.cshtml │ │ │ ├── _ExternalLoginsListPartial.cshtml │ │ │ ├── _RemoveAccountPartial.cshtml │ │ │ └── _SetPasswordPartial.cshtml │ │ ├── Albums │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Reviews │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _LoginPartial.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── packages.config └── readme.txt ├── Module 4 - Customizing Controllers ├── MVCMusicStore.Tests │ ├── App.config │ ├── Controllers │ │ └── HomeControllerTest.cs │ ├── MVCMusicStore.Tests.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── MVCMusicStore.sln ├── MVCMusicStore │ ├── App_Data │ │ ├── MVCMusicStore.Models.StoreContext.mdf │ │ └── MVCMusicStore.Models.StoreContext_log.ldf │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ ├── IdentityConfig.cs │ │ ├── RouteConfig.cs │ │ └── Startup.Auth.cs │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ ├── Controllers │ │ ├── AccountController.cs │ │ ├── AlbumsController.cs │ │ ├── HomeController.cs │ │ └── ReviewsController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── MVCMusicStore.csproj │ ├── Models │ │ ├── AccountViewModels.cs │ │ ├── Album.cs │ │ ├── AlbumWithReviewsVM.cs │ │ ├── Artist.cs │ │ ├── IdentityModels.cs │ │ ├── Review.cs │ │ └── StoreContext.cs │ ├── Project_Readme.html │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.6.2.js │ │ ├── respond.js │ │ └── respond.min.js │ ├── Startup.cs │ ├── StoreDiagram.cd │ ├── Views │ │ ├── Account │ │ │ ├── ConfirmEmail.cshtml │ │ │ ├── ExternalLoginConfirmation.cshtml │ │ │ ├── ExternalLoginFailure.cshtml │ │ │ ├── ForgotPassword.cshtml │ │ │ ├── ForgotPasswordConfirmation.cshtml │ │ │ ├── Login.cshtml │ │ │ ├── Manage.cshtml │ │ │ ├── Register.cshtml │ │ │ ├── ResetPassword.cshtml │ │ │ ├── ResetPasswordConfirmation.cshtml │ │ │ ├── _ChangePasswordPartial.cshtml │ │ │ ├── _ExternalLoginsListPartial.cshtml │ │ │ ├── _RemoveAccountPartial.cshtml │ │ │ └── _SetPasswordPartial.cshtml │ │ ├── Albums │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Reviews │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _LoginPartial.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ └── packages.config └── readme.txt ├── Module 5 - Customizing Views ├── MVCMusicStore │ ├── MVCMusicStore.Tests │ │ ├── App.config │ │ ├── Controllers │ │ │ └── HomeControllerTest.cs │ │ ├── MVCMusicStore.Tests.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── MVCMusicStore.sln │ └── MVCMusicStore │ │ ├── App_Data │ │ ├── MVCMusicStore.Models.StoreContext.mdf │ │ └── MVCMusicStore.Models.StoreContext_log.ldf │ │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ ├── IdentityConfig.cs │ │ ├── RouteConfig.cs │ │ └── Startup.Auth.cs │ │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ │ ├── Controllers │ │ ├── AccountController.cs │ │ ├── AlbumsController.cs │ │ ├── HomeController.cs │ │ └── ReviewsController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── MVCMusicStore.csproj │ │ ├── Models │ │ ├── AccountViewModels.cs │ │ ├── Album.cs │ │ ├── Artist.cs │ │ ├── IdentityModels.cs │ │ ├── Review.cs │ │ └── StoreContext.cs │ │ ├── Project_Readme.html │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.6.2.js │ │ ├── respond.js │ │ └── respond.min.js │ │ ├── Startup.cs │ │ ├── StoreDiagram.cd │ │ ├── Views │ │ ├── Account │ │ │ ├── ConfirmEmail.cshtml │ │ │ ├── ExternalLoginConfirmation.cshtml │ │ │ ├── ExternalLoginFailure.cshtml │ │ │ ├── ForgotPassword.cshtml │ │ │ ├── ForgotPasswordConfirmation.cshtml │ │ │ ├── Login.cshtml │ │ │ ├── Manage.cshtml │ │ │ ├── Register.cshtml │ │ │ ├── ResetPassword.cshtml │ │ │ ├── ResetPasswordConfirmation.cshtml │ │ │ ├── _ChangePasswordPartial.cshtml │ │ │ ├── _ExternalLoginsListPartial.cshtml │ │ │ ├── _RemoveAccountPartial.cshtml │ │ │ └── _SetPasswordPartial.cshtml │ │ ├── Albums │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Reviews │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _LoginPartial.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ ├── favicon.ico │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ │ └── packages.config └── readme.txt ├── Module 6 - Introduction to Bootstrap ├── MVCMusicStore │ ├── MVCMusicStore.Tests │ │ ├── App.config │ │ ├── Controllers │ │ │ └── HomeControllerTest.cs │ │ ├── MVCMusicStore.Tests.csproj │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── packages.config │ ├── MVCMusicStore.sln │ └── MVCMusicStore │ │ ├── App_Data │ │ ├── MVCMusicStore.Models.StoreContext.mdf │ │ └── MVCMusicStore.Models.StoreContext_log.ldf │ │ ├── App_Start │ │ ├── BundleConfig.cs │ │ ├── FilterConfig.cs │ │ ├── IdentityConfig.cs │ │ ├── RouteConfig.cs │ │ └── Startup.Auth.cs │ │ ├── Content │ │ ├── Site.css │ │ ├── bootstrap.css │ │ └── bootstrap.min.css │ │ ├── Controllers │ │ ├── AccountController.cs │ │ ├── AlbumsController.cs │ │ ├── HomeController.cs │ │ └── ReviewsController.cs │ │ ├── Global.asax │ │ ├── Global.asax.cs │ │ ├── MVCMusicStore.csproj │ │ ├── Models │ │ ├── AccountViewModels.cs │ │ ├── Album.cs │ │ ├── Artist.cs │ │ ├── IdentityModels.cs │ │ ├── Review.cs │ │ └── StoreContext.cs │ │ ├── Project_Readme.html │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ ├── Scripts │ │ ├── _references.js │ │ ├── bootstrap.js │ │ ├── bootstrap.min.js │ │ ├── jquery-1.10.2.intellisense.js │ │ ├── jquery-1.10.2.js │ │ ├── jquery-1.10.2.min.js │ │ ├── jquery-1.10.2.min.map │ │ ├── jquery.validate-vsdoc.js │ │ ├── jquery.validate.js │ │ ├── jquery.validate.min.js │ │ ├── jquery.validate.unobtrusive.js │ │ ├── jquery.validate.unobtrusive.min.js │ │ ├── modernizr-2.6.2.js │ │ ├── respond.js │ │ └── respond.min.js │ │ ├── Startup.cs │ │ ├── StoreDiagram.cd │ │ ├── Views │ │ ├── Account │ │ │ ├── ConfirmEmail.cshtml │ │ │ ├── ExternalLoginConfirmation.cshtml │ │ │ ├── ExternalLoginFailure.cshtml │ │ │ ├── ForgotPassword.cshtml │ │ │ ├── ForgotPasswordConfirmation.cshtml │ │ │ ├── Login.cshtml │ │ │ ├── Manage.cshtml │ │ │ ├── Register.cshtml │ │ │ ├── ResetPassword.cshtml │ │ │ ├── ResetPasswordConfirmation.cshtml │ │ │ ├── _ChangePasswordPartial.cshtml │ │ │ ├── _ExternalLoginsListPartial.cshtml │ │ │ ├── _RemoveAccountPartial.cshtml │ │ │ └── _SetPasswordPartial.cshtml │ │ ├── Albums │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Home │ │ │ ├── About.cshtml │ │ │ ├── Contact.cshtml │ │ │ └── Index.cshtml │ │ ├── Reviews │ │ │ ├── Create.cshtml │ │ │ ├── Delete.cshtml │ │ │ ├── Details.cshtml │ │ │ ├── Edit.cshtml │ │ │ └── Index.cshtml │ │ ├── Shared │ │ │ ├── Error.cshtml │ │ │ ├── _Layout.cshtml │ │ │ └── _LoginPartial.cshtml │ │ ├── Web.config │ │ └── _ViewStart.cshtml │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Web.config │ │ ├── favicon.ico │ │ ├── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ └── glyphicons-halflings-regular.woff │ │ └── packages.config └── readme.txt └── Module 7 - Introduction to Authentication ├── MVCMusicStore ├── MVCMusicStore.Tests │ ├── App.config │ ├── Controllers │ │ └── HomeControllerTest.cs │ ├── MVCMusicStore.Tests.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ └── packages.config ├── MVCMusicStore.sln └── MVCMusicStore │ ├── App_Data │ ├── MVCMusicStore.Models.StoreContext.mdf │ ├── MVCMusicStore.Models.StoreContext_log.ldf │ ├── aspnet-MVCMusicStore-20140623095615.mdf │ └── aspnet-MVCMusicStore-20140623095615_log.ldf │ ├── App_Start │ ├── BundleConfig.cs │ ├── FilterConfig.cs │ ├── IdentityConfig.cs │ ├── RouteConfig.cs │ └── Startup.Auth.cs │ ├── Content │ ├── Site.css │ ├── bootstrap.css │ └── bootstrap.min.css │ ├── Controllers │ ├── AccountController.cs │ ├── AlbumsController.cs │ ├── HomeController.cs │ └── ReviewsController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── MVCMusicStore.csproj │ ├── Models │ ├── AccountViewModels.cs │ ├── Album.cs │ ├── Artist.cs │ ├── IdentityModels.cs │ ├── Review.cs │ └── StoreContext.cs │ ├── Project_Readme.html │ ├── Properties │ └── AssemblyInfo.cs │ ├── Scripts │ ├── _references.js │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── jquery-1.10.2.intellisense.js │ ├── jquery-1.10.2.js │ ├── jquery-1.10.2.min.js │ ├── jquery-1.10.2.min.map │ ├── jquery.validate-vsdoc.js │ ├── jquery.validate.js │ ├── jquery.validate.min.js │ ├── jquery.validate.unobtrusive.js │ ├── jquery.validate.unobtrusive.min.js │ ├── modernizr-2.6.2.js │ ├── respond.js │ └── respond.min.js │ ├── Startup.cs │ ├── StoreDiagram.cd │ ├── Views │ ├── Account │ │ ├── ConfirmEmail.cshtml │ │ ├── ExternalLoginConfirmation.cshtml │ │ ├── ExternalLoginFailure.cshtml │ │ ├── ForgotPassword.cshtml │ │ ├── ForgotPasswordConfirmation.cshtml │ │ ├── Login.cshtml │ │ ├── Manage.cshtml │ │ ├── Register.cshtml │ │ ├── ResetPassword.cshtml │ │ ├── ResetPasswordConfirmation.cshtml │ │ ├── _ChangePasswordPartial.cshtml │ │ ├── _ExternalLoginsListPartial.cshtml │ │ ├── _RemoveAccountPartial.cshtml │ │ └── _SetPasswordPartial.cshtml │ ├── Albums │ │ ├── Create.cshtml │ │ ├── Delete.cshtml │ │ ├── Details.cshtml │ │ ├── Edit.cshtml │ │ └── Index.cshtml │ ├── Home │ │ ├── About.cshtml │ │ ├── Contact.cshtml │ │ └── Index.cshtml │ ├── Reviews │ │ ├── Create.cshtml │ │ ├── Delete.cshtml │ │ ├── Details.cshtml │ │ ├── Edit.cshtml │ │ └── Index.cshtml │ ├── Shared │ │ ├── Error.cshtml │ │ ├── _Layout.cshtml │ │ └── _LoginPartial.cshtml │ ├── Web.config │ └── _ViewStart.cshtml │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── favicon.ico │ ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff │ └── packages.config └── readme.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # git-ls-files --others --exclude-from=.git/info/exclude 2 | # Lines that start with '#' are comments. 3 | # For a project mostly in C, the following would be a good set of 4 | # exclude patterns (uncomment them if you want to use them): 5 | # *.[oa] 6 | # *~ 7 | *.o 8 | *.sdf 9 | *.lo 10 | *.la 11 | *.al 12 | .libs 13 | *.so 14 | *.a 15 | *.pyc 16 | *.pyo 17 | *.rej 18 | *.suo 19 | *.user 20 | *.cache 21 | *.xap 22 | *.log 23 | *.vspcc 24 | *.vspscc 25 | *.vscc 26 | *.vssscc 27 | *~ 28 | *.*~ 29 | .*.swp 30 | .DS_Store 31 | bin 32 | Bin 33 | obj 34 | Obj 35 | Debug 36 | Release 37 | *.suo 38 | *.user 39 | TestResults 40 | *.Cache 41 | _ReSharper.* 42 | ClientBin 43 | stylecop.* 44 | pkgobj 45 | pkg 46 | .svn 47 | .builds 48 | ~$* 49 | *.dbmdl 50 | coverage 51 | packages 52 | *.docstates 53 | *.InstallLog 54 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore.Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore.Tests/Controllers/HomeControllerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.Mvc; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using MVCMusicStore; 8 | using MVCMusicStore.Controllers; 9 | 10 | namespace MVCMusicStore.Tests.Controllers 11 | { 12 | [TestClass] 13 | public class HomeControllerTest 14 | { 15 | [TestMethod] 16 | public void Index() 17 | { 18 | // Arrange 19 | HomeController controller = new HomeController(); 20 | 21 | // Act 22 | ViewResult result = controller.Index() as ViewResult; 23 | 24 | // Assert 25 | Assert.IsNotNull(result); 26 | } 27 | 28 | [TestMethod] 29 | public void About() 30 | { 31 | // Arrange 32 | HomeController controller = new HomeController(); 33 | 34 | // Act 35 | ViewResult result = controller.About() as ViewResult; 36 | 37 | // Assert 38 | Assert.AreEqual("Your application description page.", result.ViewBag.Message); 39 | } 40 | 41 | [TestMethod] 42 | public void Contact() 43 | { 44 | // Arrange 45 | HomeController controller = new HomeController(); 46 | 47 | // Act 48 | ViewResult result = controller.Contact() as ViewResult; 49 | 50 | // Assert 51 | Assert.IsNotNull(result); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/App_Data/aspnet-MVCMusicStore-20140623095615.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/App_Data/aspnet-MVCMusicStore-20140623095615.mdf -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/App_Data/aspnet-MVCMusicStore-20140623095615_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/App_Data/aspnet-MVCMusicStore-20140623095615_log.ldf -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MVCMusicStore 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MVCMusicStore 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapMvcAttributeRoutes();//Attribute Routing 17 | 18 | routes.MapRoute( 19 | name: "Default", 20 | url: "{controller}/{action}/{id}", 21 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 22 | ); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace MVCMusicStore.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MVCMusicStore.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace MVCMusicStore 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Models/Album.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Album 9 | { 10 | public int AlbumID { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public Artist Artist { get; set; } 15 | 16 | public virtual List Review { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Models/Artist.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Artist 9 | { 10 | public int ArtistID { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public virtual List Albums { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Models/Review.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class Review 10 | { 11 | public int ReviewID { get; set; } 12 | 13 | [Display(Name="Album")] 14 | public int AlbumID { get; set; } 15 | public virtual Album Album { get; set; } 16 | 17 | public string Contents { get; set; } 18 | 19 | [Required()] 20 | [Display(Name="Email Address")] 21 | [DataType(DataType.EmailAddress)] 22 | public string ReviewerEmail { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Models/StoreContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class StoreContext : DbContext 10 | { 11 | public DbSet Reviews { get; set; } 12 | public DbSet Albums { get; set; } 13 | public DbSet Artists { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/Scripts/_references.js -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | 4 | [assembly: OwinStartupAttribute(typeof(MVCMusicStore.Startup))] 5 | namespace MVCMusicStore 6 | { 7 | public partial class Startup 8 | { 9 | public void Configuration(IAppBuilder app) 10 | { 11 | ConfigureAuth(app); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/StoreDiagram.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AAAAAAAAAAAAAEAAAACAAAAAAIAAAAAAAACAAAAAAAA= 7 | Models\Album.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACBAAAAA= 14 | Models\Artist.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAAAAAAAAAAACAAAAAABAAAAABAAAACABAAAA= 21 | Models\Review.cs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "ConfirmAccount"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |
7 |

8 | Thank you for confirming your account. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 9 |

10 |
11 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |

Unsuccessful login with service.

7 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ForgotPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Forgot your password?"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Enter your email.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Forgot Password Confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Please check your email to reset your password. 11 |

12 |
13 | 14 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Account/Manage.cshtml: -------------------------------------------------------------------------------- 1 | @using MVCMusicStore.Models; 2 | @using Microsoft.AspNet.Identity; 3 | @{ 4 | ViewBag.Title = "Manage Account"; 5 | } 6 | 7 |

@ViewBag.Title.

8 | 9 |

@ViewBag.StatusMessage

10 |
11 |
12 | @if (ViewBag.HasLocalPassword) 13 | { 14 | @Html.Partial("_ChangePasswordPartial") 15 | } 16 | else 17 | { 18 | @Html.Partial("_SetPasswordPartial") 19 | } 20 | 21 |
22 | @Html.Action("RemoveAccountList") 23 | @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl }) 24 |
25 |
26 |
27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Reset password confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 11 |

12 |
13 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Account/_ExternalLoginsListPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using MVCMusicStore.Models 2 | @model ExternalLoginListViewModel 3 | @using Microsoft.Owin.Security 4 | 5 |

Use another service to log in.

6 |
7 | @{ 8 | var loginProviders = Context.GetOwinContext().Authentication.GetExternalAuthenticationTypes(); 9 | if (loginProviders.Count() == 0) 10 | { 11 |
12 |

There are no external authentication services configured. See this article 13 | for details on setting up this ASP.NET application to support logging in via external services.

14 |
15 | } 16 | else 17 | { 18 | using (Html.BeginForm(Model.Action, "Account", new { ReturnUrl = Model.ReturnUrl })) 19 | { 20 | @Html.AntiForgeryToken() 21 |
22 |

23 | @foreach (AuthenticationDescription p in loginProviders) 24 | { 25 | 26 | } 27 |

28 |
29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Account/_SetPasswordPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ManageUserViewModel 2 | 3 |

4 | You do not have a local username/password for this site. Add a local 5 | account so you can log in without an external login. 6 |

7 | 8 | @using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |

Create Local Login

13 |
14 | @Html.ValidationSummary("", new { @class = "text-danger" }) 15 |
16 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 17 |
18 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 19 |
20 |
21 |
22 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 23 |
24 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 | } 33 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Albums/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Create"; 5 | } 6 | 7 |

Create a new wonderful album!

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 |
19 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 20 |
21 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 22 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 |
31 |
32 | } 33 | 34 |
35 | @Html.ActionLink("Back to List", "Index") 36 |
37 | 38 | @section Scripts { 39 | @Scripts.Render("~/bundles/jqueryval") 40 | } 41 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Albums/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Album

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | 24 | @using (Html.BeginForm()) { 25 | @Html.AntiForgeryToken() 26 | 27 |
28 | | 29 | @Html.ActionLink("Back to List", "Index") 30 |
31 | } 32 |
33 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Albums/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Album

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Title) 19 |
20 | 21 |
22 |
23 |

24 | @Html.ActionLink("Edit", "Edit", new { id = Model.AlbumID }) | 25 | @Html.ActionLink("Back to List", "Index") 26 |

27 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Albums/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Edit"; 5 | } 6 | 7 |

Edit

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 | @Html.HiddenFor(model => model.AlbumID) 19 | 20 |
21 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 22 |
23 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 24 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 25 |
26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 | } 35 | 36 |
37 | @Html.ActionLink("Back to List", "Index") 38 |
39 | 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } 43 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Albums/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 18 | 19 | 20 | @foreach (var item in Model) { 21 | 22 | 25 | 30 | 31 | } 32 | 33 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
23 | @Html.DisplayFor(wibble => item.Title) 24 | 26 | @Html.ActionLink("Edit", "Edit", new { id=item.AlbumID }) | 27 | @Html.ActionLink("Details", "Details", new { id=item.AlbumID }) | 28 | @Html.ActionLink("Delete", "Delete", new { id=item.AlbumID }) 29 |
34 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Reviews/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Review

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Album.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Contents) 24 |
25 | 26 |
27 | @Html.DisplayFor(model => model.Contents) 28 |
29 | 30 |
31 | @Html.DisplayNameFor(model => model.ReviewerEmail) 32 |
33 | 34 |
35 | @Html.DisplayFor(model => model.ReviewerEmail) 36 |
37 | 38 |
39 | 40 | @using (Html.BeginForm()) { 41 | @Html.AntiForgeryToken() 42 | 43 |
44 | | 45 | @Html.ActionLink("Back to List", "Index") 46 |
47 | } 48 |
49 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Reviews/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Review

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Album.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Album.Title) 19 |
20 | 21 |
22 | @Html.DisplayNameFor(model => model.Contents) 23 |
24 | 25 |
26 | @Html.DisplayFor(model => model.Contents) 27 |
28 | 29 |
30 | @Html.DisplayNameFor(model => model.ReviewerEmail) 31 |
32 | 33 |
34 | @Html.DisplayFor(model => model.ReviewerEmail) 35 |
36 | 37 |
38 |
39 |

40 | @Html.ActionLink("Edit", "Edit", new { id = Model.ReviewID }) | 41 | @Html.ActionLink("Back to List", "Index") 42 |

43 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Reviews/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 37 | 42 | 43 | } 44 | 45 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 | 18 | @Html.DisplayNameFor(model => model.Contents) 19 | 21 | @Html.DisplayNameFor(model => model.ReviewerEmail) 22 |
29 | @Html.DisplayFor(modelItem => item.Album.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Contents) 33 | 35 | @Html.DisplayFor(modelItem => item.ReviewerEmail) 36 | 38 | @Html.ActionLink("Edit", "Edit", new { id=item.ReviewID }) | 39 | @Html.ActionLink("Details", "Details", new { id=item.ReviewID }) | 40 | @Html.ActionLink("Delete", "Delete", new { id=item.ReviewID }) 41 |
46 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 22 | } 23 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/favicon.ico -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Module 1 - Basics of MVC/readme.txt: -------------------------------------------------------------------------------- 1 | (no code for this session) -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore.Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore.Tests/Controllers/HomeControllerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.Mvc; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using MVCMusicStore; 8 | using MVCMusicStore.Controllers; 9 | 10 | namespace MVCMusicStore.Tests.Controllers 11 | { 12 | [TestClass] 13 | public class HomeControllerTest 14 | { 15 | [TestMethod] 16 | public void Index() 17 | { 18 | // Arrange 19 | HomeController controller = new HomeController(); 20 | 21 | // Act 22 | ViewResult result = controller.Index() as ViewResult; 23 | 24 | // Assert 25 | Assert.IsNotNull(result); 26 | } 27 | 28 | [TestMethod] 29 | public void About() 30 | { 31 | // Arrange 32 | HomeController controller = new HomeController(); 33 | 34 | // Act 35 | ViewResult result = controller.About() as ViewResult; 36 | 37 | // Assert 38 | Assert.AreEqual("Your application description page.", result.ViewBag.Message); 39 | } 40 | 41 | [TestMethod] 42 | public void Contact() 43 | { 44 | // Arrange 45 | HomeController controller = new HomeController(); 46 | 47 | // Act 48 | ViewResult result = controller.Contact() as ViewResult; 49 | 50 | // Assert 51 | Assert.IsNotNull(result); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MVCMusicStore 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MVCMusicStore 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace MVCMusicStore.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MVCMusicStore.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace MVCMusicStore 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Models/Album.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Album 9 | { 10 | public int AlbumID { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public Artist Artist { get; set; } 15 | 16 | public virtual List Review { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Models/Artist.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Artist 9 | { 10 | public int ArtistID { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public virtual List Albums { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Models/IdentityModels.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNet.Identity; 4 | using Microsoft.AspNet.Identity.EntityFramework; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. 9 | public class ApplicationUser : IdentityUser 10 | { 11 | public async Task GenerateUserIdentityAsync(UserManager manager) 12 | { 13 | // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType 14 | var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); 15 | // Add custom user claims here 16 | return userIdentity; 17 | } 18 | } 19 | 20 | public class ApplicationDbContext : IdentityDbContext 21 | { 22 | public ApplicationDbContext() 23 | : base("DefaultConnection", throwIfV1Schema: false) 24 | { 25 | } 26 | 27 | public static ApplicationDbContext Create() 28 | { 29 | return new ApplicationDbContext(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Models/Review.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class Review 10 | { 11 | public int ReviewID { get; set; } 12 | 13 | public int AlbumID { get; set; } 14 | public virtual Album Album { get; set; } 15 | 16 | public string Contents { get; set; } 17 | 18 | [Required()] 19 | [Display(Name="Email Address")] 20 | [DataType(DataType.EmailAddress)] 21 | public string ReviewerEmail { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Models/StoreContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class StoreContext : DbContext 10 | { 11 | public DbSet Reviews { get; set; } 12 | public DbSet Albums { get; set; } 13 | public DbSet Artists { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 2 - Models in MVC/MVCMusicStore/Scripts/_references.js -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | 4 | [assembly: OwinStartupAttribute(typeof(MVCMusicStore.Startup))] 5 | namespace MVCMusicStore 6 | { 7 | public partial class Startup 8 | { 9 | public void Configuration(IAppBuilder app) 10 | { 11 | ConfigureAuth(app); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/StoreDiagram.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AAAAAAAAAAAAAEAAAACAAAAAAIAAAAAAAACAAAAAAAA= 7 | Models\Album.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACBAAAAA= 14 | Models\Artist.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAAAAAAAAAAACAAAAAABAAAAABAAAACABAAAA= 21 | Models\Review.cs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "ConfirmAccount"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |
7 |

8 | Thank you for confirming your account. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 9 |

10 |
11 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |

Unsuccessful login with service.

7 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ForgotPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Forgot your password?"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Enter your email.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Forgot Password Confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Please check your email to reset your password. 11 |

12 |
13 | 14 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Account/Manage.cshtml: -------------------------------------------------------------------------------- 1 | @using MVCMusicStore.Models; 2 | @using Microsoft.AspNet.Identity; 3 | @{ 4 | ViewBag.Title = "Manage Account"; 5 | } 6 | 7 |

@ViewBag.Title.

8 | 9 |

@ViewBag.StatusMessage

10 |
11 |
12 | @if (ViewBag.HasLocalPassword) 13 | { 14 | @Html.Partial("_ChangePasswordPartial") 15 | } 16 | else 17 | { 18 | @Html.Partial("_SetPasswordPartial") 19 | } 20 | 21 |
22 | @Html.Action("RemoveAccountList") 23 | @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl }) 24 |
25 |
26 |
27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Reset password confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 11 |

12 |
13 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Account/_SetPasswordPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ManageUserViewModel 2 | 3 |

4 | You do not have a local username/password for this site. Add a local 5 | account so you can log in without an external login. 6 |

7 | 8 | @using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |

Create Local Login

13 |
14 | @Html.ValidationSummary("", new { @class = "text-danger" }) 15 |
16 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 17 |
18 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 19 |
20 |
21 |
22 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 23 |
24 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 | } 33 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Albums/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Create"; 5 | } 6 | 7 |

Create

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 |
19 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 20 |
21 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 22 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 |
31 |
32 | } 33 | 34 |
35 | @Html.ActionLink("Back to List", "Index") 36 |
37 | 38 | @section Scripts { 39 | @Scripts.Render("~/bundles/jqueryval") 40 | } 41 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Albums/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Album

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | 24 | @using (Html.BeginForm()) { 25 | @Html.AntiForgeryToken() 26 | 27 |
28 | | 29 | @Html.ActionLink("Back to List", "Index") 30 |
31 | } 32 |
33 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Albums/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Album

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Title) 19 |
20 | 21 |
22 |
23 |

24 | @Html.ActionLink("Edit", "Edit", new { id = Model.AlbumID }) | 25 | @Html.ActionLink("Back to List", "Index") 26 |

27 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Albums/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Edit"; 5 | } 6 | 7 |

Edit

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 | @Html.HiddenFor(model => model.AlbumID) 19 | 20 |
21 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 22 |
23 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 24 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 25 |
26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 | } 35 | 36 |
37 | @Html.ActionLink("Back to List", "Index") 38 |
39 | 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } 43 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Albums/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 18 | 19 | 20 | @foreach (var item in Model) { 21 | 22 | 25 | 30 | 31 | } 32 | 33 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
23 | @Html.DisplayFor(modelItem => item.Title) 24 | 26 | @Html.ActionLink("Edit", "Edit", new { id=item.AlbumID }) | 27 | @Html.ActionLink("Details", "Details", new { id=item.AlbumID }) | 28 | @Html.ActionLink("Delete", "Delete", new { id=item.AlbumID }) 29 |
34 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Reviews/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Review

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Album.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Contents) 24 |
25 | 26 |
27 | @Html.DisplayFor(model => model.Contents) 28 |
29 | 30 |
31 | @Html.DisplayNameFor(model => model.ReviewerEmail) 32 |
33 | 34 |
35 | @Html.DisplayFor(model => model.ReviewerEmail) 36 |
37 | 38 |
39 | 40 | @using (Html.BeginForm()) { 41 | @Html.AntiForgeryToken() 42 | 43 |
44 | | 45 | @Html.ActionLink("Back to List", "Index") 46 |
47 | } 48 |
49 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Reviews/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Review

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Album.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Album.Title) 19 |
20 | 21 |
22 | @Html.DisplayNameFor(model => model.Contents) 23 |
24 | 25 |
26 | @Html.DisplayFor(model => model.Contents) 27 |
28 | 29 |
30 | @Html.DisplayNameFor(model => model.ReviewerEmail) 31 |
32 | 33 |
34 | @Html.DisplayFor(model => model.ReviewerEmail) 35 |
36 | 37 |
38 |
39 |

40 | @Html.ActionLink("Edit", "Edit", new { id = Model.ReviewID }) | 41 | @Html.ActionLink("Back to List", "Index") 42 |

43 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Reviews/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 37 | 42 | 43 | } 44 | 45 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 | 18 | @Html.DisplayNameFor(model => model.Contents) 19 | 21 | @Html.DisplayNameFor(model => model.ReviewerEmail) 22 |
29 | @Html.DisplayFor(modelItem => item.Album.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Contents) 33 | 35 | @Html.DisplayFor(modelItem => item.ReviewerEmail) 36 | 38 | @Html.ActionLink("Edit", "Edit", new { id=item.ReviewID }) | 39 | @Html.ActionLink("Details", "Details", new { id=item.ReviewID }) | 40 | @Html.ActionLink("Delete", "Delete", new { id=item.ReviewID }) 41 |
46 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 22 | } 23 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 2 - Models in MVC/MVCMusicStore/favicon.ico -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 2 - Models in MVC/MVCMusicStore/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 2 - Models in MVC/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Module 2 - Models in MVC/MVCMusicStore/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 2 - Models in MVC/MVCMusicStore/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Module 2 - Models in MVC/readme.txt: -------------------------------------------------------------------------------- 1 | Source code for the Introduction to ASP.NET MVC free training course on June 23, 2014 (http://www.microsoftvirtualacademy.com/liveevents/introduction-to-asp-net-mvc) -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore.Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore.Tests/Controllers/HomeControllerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.Mvc; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using MVCMusicStore; 8 | using MVCMusicStore.Controllers; 9 | 10 | namespace MVCMusicStore.Tests.Controllers 11 | { 12 | [TestClass] 13 | public class HomeControllerTest 14 | { 15 | [TestMethod] 16 | public void Index() 17 | { 18 | // Arrange 19 | HomeController controller = new HomeController(); 20 | 21 | // Act 22 | ViewResult result = controller.Index() as ViewResult; 23 | 24 | // Assert 25 | Assert.IsNotNull(result); 26 | } 27 | 28 | [TestMethod] 29 | public void About() 30 | { 31 | // Arrange 32 | HomeController controller = new HomeController(); 33 | 34 | // Act 35 | ViewResult result = controller.About() as ViewResult; 36 | 37 | // Assert 38 | Assert.AreEqual("Your application description page.", result.ViewBag.Message); 39 | } 40 | 41 | [TestMethod] 42 | public void Contact() 43 | { 44 | // Arrange 45 | HomeController controller = new HomeController(); 46 | 47 | // Act 48 | ViewResult result = controller.Contact() as ViewResult; 49 | 50 | // Assert 51 | Assert.IsNotNull(result); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 3 - Visual Studio tools/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 3 - Visual Studio tools/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MVCMusicStore 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MVCMusicStore 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapRoute( 17 | name: "Default", 18 | url: "{controller}/{action}/{id}", 19 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 20 | ); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace MVCMusicStore.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MVCMusicStore.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace MVCMusicStore 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Models/Album.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Album 9 | { 10 | public int AlbumID { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public Artist Artist { get; set; } 15 | 16 | public virtual List Review { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Models/Artist.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Artist 9 | { 10 | public int ArtistID { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public virtual List Albums { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Models/IdentityModels.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNet.Identity; 4 | using Microsoft.AspNet.Identity.EntityFramework; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. 9 | public class ApplicationUser : IdentityUser 10 | { 11 | public async Task GenerateUserIdentityAsync(UserManager manager) 12 | { 13 | // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType 14 | var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); 15 | // Add custom user claims here 16 | return userIdentity; 17 | } 18 | } 19 | 20 | public class ApplicationDbContext : IdentityDbContext 21 | { 22 | public ApplicationDbContext() 23 | : base("DefaultConnection", throwIfV1Schema: false) 24 | { 25 | } 26 | 27 | public static ApplicationDbContext Create() 28 | { 29 | return new ApplicationDbContext(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Models/Review.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class Review 10 | { 11 | public int ReviewID { get; set; } 12 | 13 | public int AlbumID { get; set; } 14 | public virtual Album Album { get; set; } 15 | 16 | public string Contents { get; set; } 17 | 18 | [Required()] 19 | [Display(Name="Email Address")] 20 | [DataType(DataType.EmailAddress)] 21 | public string ReviewerEmail { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Models/StoreContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class StoreContext : DbContext 10 | { 11 | public DbSet Reviews { get; set; } 12 | public DbSet Albums { get; set; } 13 | public DbSet Artists { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 3 - Visual Studio tools/MVCMusicStore/Scripts/_references.js -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | 4 | [assembly: OwinStartupAttribute(typeof(MVCMusicStore.Startup))] 5 | namespace MVCMusicStore 6 | { 7 | public partial class Startup 8 | { 9 | public void Configuration(IAppBuilder app) 10 | { 11 | ConfigureAuth(app); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/StoreDiagram.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AAAAAAAAAAAAAEAAAACAAAAAAIAAAAAAAACAAAAAAAA= 7 | Models\Album.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACBAAAAA= 14 | Models\Artist.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAAAAAAAAAAACAAAAAABAAAAABAAAACABAAAA= 21 | Models\Review.cs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "ConfirmAccount"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |
7 |

8 | Thank you for confirming your account. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 9 |

10 |
11 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |

Unsuccessful login with service.

7 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ForgotPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Forgot your password?"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Enter your email.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Forgot Password Confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Please check your email to reset your password. 11 |

12 |
13 | 14 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Account/Manage.cshtml: -------------------------------------------------------------------------------- 1 | @using MVCMusicStore.Models; 2 | @using Microsoft.AspNet.Identity; 3 | @{ 4 | ViewBag.Title = "Manage Account"; 5 | } 6 | 7 |

@ViewBag.Title.

8 | 9 |

@ViewBag.StatusMessage

10 |
11 |
12 | @if (ViewBag.HasLocalPassword) 13 | { 14 | @Html.Partial("_ChangePasswordPartial") 15 | } 16 | else 17 | { 18 | @Html.Partial("_SetPasswordPartial") 19 | } 20 | 21 |
22 | @Html.Action("RemoveAccountList") 23 | @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl }) 24 |
25 |
26 |
27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Reset password confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 11 |

12 |
13 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Account/_SetPasswordPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ManageUserViewModel 2 | 3 |

4 | You do not have a local username/password for this site. Add a local 5 | account so you can log in without an external login. 6 |

7 | 8 | @using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |

Create Local Login

13 |
14 | @Html.ValidationSummary("", new { @class = "text-danger" }) 15 |
16 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 17 |
18 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 19 |
20 |
21 |
22 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 23 |
24 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 | } 33 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Albums/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Create"; 5 | } 6 | 7 |

Create a new wonderful album!

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 |
19 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 20 |
21 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 22 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 |
31 |
32 | } 33 | 34 |
35 | @Html.ActionLink("Back to List", "Index") 36 |
37 | 38 | @section Scripts { 39 | @Scripts.Render("~/bundles/jqueryval") 40 | } 41 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Albums/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Album

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | 24 | @using (Html.BeginForm()) { 25 | @Html.AntiForgeryToken() 26 | 27 |
28 | | 29 | @Html.ActionLink("Back to List", "Index") 30 |
31 | } 32 |
33 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Albums/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Album

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Title) 19 |
20 | 21 |
22 |
23 |

24 | @Html.ActionLink("Edit", "Edit", new { id = Model.AlbumID }) | 25 | @Html.ActionLink("Back to List", "Index") 26 |

27 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Albums/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Edit"; 5 | } 6 | 7 |

Edit

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 | @Html.HiddenFor(model => model.AlbumID) 19 | 20 |
21 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 22 |
23 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 24 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 25 |
26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 | } 35 | 36 |
37 | @Html.ActionLink("Back to List", "Index") 38 |
39 | 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } 43 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Albums/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 18 | 19 | 20 | @foreach (var item in Model) { 21 | 22 | 25 | 30 | 31 | } 32 | 33 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
23 | @Html.DisplayFor(modelItem => item.Title) 24 | 26 | @Html.ActionLink("Edit", "Edit", new { id=item.AlbumID }) | 27 | @Html.ActionLink("Details", "Details", new { id=item.AlbumID }) | 28 | @Html.ActionLink("Delete", "Delete", new { id=item.AlbumID }) 29 |
34 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Reviews/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Review

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Album.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Contents) 24 |
25 | 26 |
27 | @Html.DisplayFor(model => model.Contents) 28 |
29 | 30 |
31 | @Html.DisplayNameFor(model => model.ReviewerEmail) 32 |
33 | 34 |
35 | @Html.DisplayFor(model => model.ReviewerEmail) 36 |
37 | 38 |
39 | 40 | @using (Html.BeginForm()) { 41 | @Html.AntiForgeryToken() 42 | 43 |
44 | | 45 | @Html.ActionLink("Back to List", "Index") 46 |
47 | } 48 |
49 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Reviews/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Review

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Album.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Album.Title) 19 |
20 | 21 |
22 | @Html.DisplayNameFor(model => model.Contents) 23 |
24 | 25 |
26 | @Html.DisplayFor(model => model.Contents) 27 |
28 | 29 |
30 | @Html.DisplayNameFor(model => model.ReviewerEmail) 31 |
32 | 33 |
34 | @Html.DisplayFor(model => model.ReviewerEmail) 35 |
36 | 37 |
38 |
39 |

40 | @Html.ActionLink("Edit", "Edit", new { id = Model.ReviewID }) | 41 | @Html.ActionLink("Back to List", "Index") 42 |

43 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Reviews/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 37 | 42 | 43 | } 44 | 45 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 | 18 | @Html.DisplayNameFor(model => model.Contents) 19 | 21 | @Html.DisplayNameFor(model => model.ReviewerEmail) 22 |
29 | @Html.DisplayFor(modelItem => item.Album.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Contents) 33 | 35 | @Html.DisplayFor(modelItem => item.ReviewerEmail) 36 | 38 | @Html.ActionLink("Edit", "Edit", new { id=item.ReviewID }) | 39 | @Html.ActionLink("Details", "Details", new { id=item.ReviewID }) | 40 | @Html.ActionLink("Delete", "Delete", new { id=item.ReviewID }) 41 |
46 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 22 | } 23 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 3 - Visual Studio tools/MVCMusicStore/favicon.ico -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 3 - Visual Studio tools/MVCMusicStore/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 3 - Visual Studio tools/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/MVCMusicStore/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 3 - Visual Studio tools/MVCMusicStore/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Module 3 - Visual Studio tools/readme.txt: -------------------------------------------------------------------------------- 1 | Source code for the Introduction to ASP.NET MVC free training course on June 23, 2014 (http://www.microsoftvirtualacademy.com/liveevents/introduction-to-asp-net-mvc) -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore.Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore.Tests/Controllers/HomeControllerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.Mvc; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using MVCMusicStore; 8 | using MVCMusicStore.Controllers; 9 | 10 | namespace MVCMusicStore.Tests.Controllers 11 | { 12 | [TestClass] 13 | public class HomeControllerTest 14 | { 15 | [TestMethod] 16 | public void Index() 17 | { 18 | // Arrange 19 | HomeController controller = new HomeController(); 20 | 21 | // Act 22 | ViewResult result = controller.Index() as ViewResult; 23 | 24 | // Assert 25 | Assert.IsNotNull(result); 26 | } 27 | 28 | [TestMethod] 29 | public void About() 30 | { 31 | // Arrange 32 | HomeController controller = new HomeController(); 33 | 34 | // Act 35 | ViewResult result = controller.About() as ViewResult; 36 | 37 | // Assert 38 | Assert.AreEqual("Your application description page.", result.ViewBag.Message); 39 | } 40 | 41 | [TestMethod] 42 | public void Contact() 43 | { 44 | // Arrange 45 | HomeController controller = new HomeController(); 46 | 47 | // Act 48 | ViewResult result = controller.Contact() as ViewResult; 49 | 50 | // Assert 51 | Assert.IsNotNull(result); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 4 - Customizing Controllers/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 4 - Customizing Controllers/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MVCMusicStore 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MVCMusicStore 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapMvcAttributeRoutes();//Attribute Routing 17 | 18 | routes.MapRoute( 19 | name: "Default", 20 | url: "{controller}/{action}/{id}", 21 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 22 | ); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace MVCMusicStore.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MVCMusicStore.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace MVCMusicStore 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Models/Album.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Album 9 | { 10 | public int AlbumID { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public Artist Artist { get; set; } 15 | 16 | public virtual List Review { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Models/AlbumWithReviewsVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class AlbumWithReviewsVM 9 | { 10 | public string AlbumTitle {get; set; } 11 | public List ReviewContent { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Models/Artist.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Artist 9 | { 10 | public int ArtistID { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public virtual List Albums { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Models/IdentityModels.cs: -------------------------------------------------------------------------------- 1 | using System.Security.Claims; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNet.Identity; 4 | using Microsoft.AspNet.Identity.EntityFramework; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. 9 | public class ApplicationUser : IdentityUser 10 | { 11 | public async Task GenerateUserIdentityAsync(UserManager manager) 12 | { 13 | // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType 14 | var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); 15 | // Add custom user claims here 16 | return userIdentity; 17 | } 18 | } 19 | 20 | public class ApplicationDbContext : IdentityDbContext 21 | { 22 | public ApplicationDbContext() 23 | : base("DefaultConnection", throwIfV1Schema: false) 24 | { 25 | } 26 | 27 | public static ApplicationDbContext Create() 28 | { 29 | return new ApplicationDbContext(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Models/Review.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class Review 10 | { 11 | public int ReviewID { get; set; } 12 | 13 | public int AlbumID { get; set; } 14 | public virtual Album Album { get; set; } 15 | 16 | public string Contents { get; set; } 17 | 18 | [Required()] 19 | [Display(Name="Email Address")] 20 | [DataType(DataType.EmailAddress)] 21 | public string ReviewerEmail { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Models/StoreContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class StoreContext : DbContext 10 | { 11 | public DbSet Reviews { get; set; } 12 | public DbSet Albums { get; set; } 13 | public DbSet Artists { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 4 - Customizing Controllers/MVCMusicStore/Scripts/_references.js -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | 4 | [assembly: OwinStartupAttribute(typeof(MVCMusicStore.Startup))] 5 | namespace MVCMusicStore 6 | { 7 | public partial class Startup 8 | { 9 | public void Configuration(IAppBuilder app) 10 | { 11 | ConfigureAuth(app); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/StoreDiagram.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AAAAAAAAAAAAAEAAAACAAAAAAIAAAAAAAACAAAAAAAA= 7 | Models\Album.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACBAAAAA= 14 | Models\Artist.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAAAAAAAAAAACAAAAAABAAAAABAAAACABAAAA= 21 | Models\Review.cs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "ConfirmAccount"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |
7 |

8 | Thank you for confirming your account. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 9 |

10 |
11 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |

Unsuccessful login with service.

7 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ForgotPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Forgot your password?"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Enter your email.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Forgot Password Confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Please check your email to reset your password. 11 |

12 |
13 | 14 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Account/Manage.cshtml: -------------------------------------------------------------------------------- 1 | @using MVCMusicStore.Models; 2 | @using Microsoft.AspNet.Identity; 3 | @{ 4 | ViewBag.Title = "Manage Account"; 5 | } 6 | 7 |

@ViewBag.Title.

8 | 9 |

@ViewBag.StatusMessage

10 |
11 |
12 | @if (ViewBag.HasLocalPassword) 13 | { 14 | @Html.Partial("_ChangePasswordPartial") 15 | } 16 | else 17 | { 18 | @Html.Partial("_SetPasswordPartial") 19 | } 20 | 21 |
22 | @Html.Action("RemoveAccountList") 23 | @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl }) 24 |
25 |
26 |
27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Reset password confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 11 |

12 |
13 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Account/_SetPasswordPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ManageUserViewModel 2 | 3 |

4 | You do not have a local username/password for this site. Add a local 5 | account so you can log in without an external login. 6 |

7 | 8 | @using (Html.BeginForm("Manage", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 | 12 |

Create Local Login

13 |
14 | @Html.ValidationSummary("", new { @class = "text-danger" }) 15 |
16 | @Html.LabelFor(m => m.NewPassword, new { @class = "col-md-2 control-label" }) 17 |
18 | @Html.PasswordFor(m => m.NewPassword, new { @class = "form-control" }) 19 |
20 |
21 |
22 | @Html.LabelFor(m => m.ConfirmPassword, new { @class = "col-md-2 control-label" }) 23 |
24 | @Html.PasswordFor(m => m.ConfirmPassword, new { @class = "form-control" }) 25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 | } 33 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Albums/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Create"; 5 | } 6 | 7 |

Create a new wonderful album!

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 |
19 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 20 |
21 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 22 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 |
31 |
32 | } 33 | 34 |
35 | @Html.ActionLink("Back to List", "Index") 36 |
37 | 38 | @section Scripts { 39 | @Scripts.Render("~/bundles/jqueryval") 40 | } 41 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Albums/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Album

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | 24 | @using (Html.BeginForm()) { 25 | @Html.AntiForgeryToken() 26 | 27 |
28 | | 29 | @Html.ActionLink("Back to List", "Index") 30 |
31 | } 32 |
33 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Albums/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Album

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Title) 19 |
20 | 21 |
22 |
23 |

24 | @Html.ActionLink("Edit", "Edit", new { id = Model.AlbumID }) | 25 | @Html.ActionLink("Back to List", "Index") 26 |

27 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Albums/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Edit"; 5 | } 6 | 7 |

Edit

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 | @Html.HiddenFor(model => model.AlbumID) 19 | 20 |
21 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 22 |
23 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 24 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 25 |
26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 | } 35 | 36 |
37 | @Html.ActionLink("Back to List", "Index") 38 |
39 | 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } 43 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Albums/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 18 | 19 | 20 | @foreach (var item in Model) { 21 | 22 | 25 | 30 | 31 | } 32 | 33 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
23 | @Html.DisplayFor(modelItem => item.Title) 24 | 26 | @Html.ActionLink("Edit", "Edit", new { id=item.AlbumID }) | 27 | @Html.ActionLink("Details", "Details", new { id=item.AlbumID }) | 28 | @Html.ActionLink("Delete", "Delete", new { id=item.AlbumID }) 29 |
34 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Reviews/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Review

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Album.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Contents) 24 |
25 | 26 |
27 | @Html.DisplayFor(model => model.Contents) 28 |
29 | 30 |
31 | @Html.DisplayNameFor(model => model.ReviewerEmail) 32 |
33 | 34 |
35 | @Html.DisplayFor(model => model.ReviewerEmail) 36 |
37 | 38 |
39 | 40 | @using (Html.BeginForm()) { 41 | @Html.AntiForgeryToken() 42 | 43 |
44 | | 45 | @Html.ActionLink("Back to List", "Index") 46 |
47 | } 48 |
49 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Reviews/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Review

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Album.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Album.Title) 19 |
20 | 21 |
22 | @Html.DisplayNameFor(model => model.Contents) 23 |
24 | 25 |
26 | @Html.DisplayFor(model => model.Contents) 27 |
28 | 29 |
30 | @Html.DisplayNameFor(model => model.ReviewerEmail) 31 |
32 | 33 |
34 | @Html.DisplayFor(model => model.ReviewerEmail) 35 |
36 | 37 |
38 |
39 |

40 | @Html.ActionLink("Edit", "Edit", new { id = Model.ReviewID }) | 41 | @Html.ActionLink("Back to List", "Index") 42 |

43 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Reviews/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 37 | 42 | 43 | } 44 | 45 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 | 18 | @Html.DisplayNameFor(model => model.Contents) 19 | 21 | @Html.DisplayNameFor(model => model.ReviewerEmail) 22 |
29 | @Html.DisplayFor(modelItem => item.Album.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Contents) 33 | 35 | @Html.DisplayFor(modelItem => item.ReviewerEmail) 36 | 38 | @Html.ActionLink("Edit", "Edit", new { id=item.ReviewID }) | 39 | @Html.ActionLink("Details", "Details", new { id=item.ReviewID }) | 40 | @Html.ActionLink("Delete", "Delete", new { id=item.ReviewID }) 41 |
46 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 22 | } 23 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 4 - Customizing Controllers/MVCMusicStore/favicon.ico -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 4 - Customizing Controllers/MVCMusicStore/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 4 - Customizing Controllers/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/MVCMusicStore/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 4 - Customizing Controllers/MVCMusicStore/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Module 4 - Customizing Controllers/readme.txt: -------------------------------------------------------------------------------- 1 | Source code for the Introduction to ASP.NET MVC free training course on June 23, 2014 (http://www.microsoftvirtualacademy.com/liveevents/introduction-to-asp-net-mvc) -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore.Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore.Tests/Controllers/HomeControllerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.Mvc; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using MVCMusicStore; 8 | using MVCMusicStore.Controllers; 9 | 10 | namespace MVCMusicStore.Tests.Controllers 11 | { 12 | [TestClass] 13 | public class HomeControllerTest 14 | { 15 | [TestMethod] 16 | public void Index() 17 | { 18 | // Arrange 19 | HomeController controller = new HomeController(); 20 | 21 | // Act 22 | ViewResult result = controller.Index() as ViewResult; 23 | 24 | // Assert 25 | Assert.IsNotNull(result); 26 | } 27 | 28 | [TestMethod] 29 | public void About() 30 | { 31 | // Arrange 32 | HomeController controller = new HomeController(); 33 | 34 | // Act 35 | ViewResult result = controller.About() as ViewResult; 36 | 37 | // Assert 38 | Assert.AreEqual("Your application description page.", result.ViewBag.Message); 39 | } 40 | 41 | [TestMethod] 42 | public void Contact() 43 | { 44 | // Arrange 45 | HomeController controller = new HomeController(); 46 | 47 | // Act 48 | ViewResult result = controller.Contact() as ViewResult; 49 | 50 | // Assert 51 | Assert.IsNotNull(result); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MVCMusicStore 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MVCMusicStore 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapMvcAttributeRoutes();//Attribute Routing 17 | 18 | routes.MapRoute( 19 | name: "Default", 20 | url: "{controller}/{action}/{id}", 21 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 22 | ); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace MVCMusicStore.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MVCMusicStore.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace MVCMusicStore 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Models/Album.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Album 9 | { 10 | public int AlbumID { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public Artist Artist { get; set; } 15 | 16 | public virtual List Review { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Models/Artist.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Artist 9 | { 10 | public int ArtistID { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public virtual List Albums { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Models/Review.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class Review 10 | { 11 | public int ReviewID { get; set; } 12 | 13 | [Display(Name="Album")] 14 | public int AlbumID { get; set; } 15 | public virtual Album Album { get; set; } 16 | 17 | public string Contents { get; set; } 18 | 19 | [Required()] 20 | [Display(Name="Email Address")] 21 | [DataType(DataType.EmailAddress)] 22 | public string ReviewerEmail { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Models/StoreContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class StoreContext : DbContext 10 | { 11 | public DbSet Reviews { get; set; } 12 | public DbSet Albums { get; set; } 13 | public DbSet Artists { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Scripts/_references.js -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | 4 | [assembly: OwinStartupAttribute(typeof(MVCMusicStore.Startup))] 5 | namespace MVCMusicStore 6 | { 7 | public partial class Startup 8 | { 9 | public void Configuration(IAppBuilder app) 10 | { 11 | ConfigureAuth(app); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/StoreDiagram.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AAAAAAAAAAAAAEAAAACAAAAAAIAAAAAAAACAAAAAAAA= 7 | Models\Album.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACBAAAAA= 14 | Models\Artist.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAAAAAAAAAAACAAAAAABAAAAABAAAACABAAAA= 21 | Models\Review.cs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "ConfirmAccount"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |
7 |

8 | Thank you for confirming your account. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 9 |

10 |
11 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |

Unsuccessful login with service.

7 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ForgotPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Forgot your password?"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Enter your email.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Forgot Password Confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Please check your email to reset your password. 11 |

12 |
13 | 14 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Account/Manage.cshtml: -------------------------------------------------------------------------------- 1 | @using MVCMusicStore.Models; 2 | @using Microsoft.AspNet.Identity; 3 | @{ 4 | ViewBag.Title = "Manage Account"; 5 | } 6 | 7 |

@ViewBag.Title.

8 | 9 |

@ViewBag.StatusMessage

10 |
11 |
12 | @if (ViewBag.HasLocalPassword) 13 | { 14 | @Html.Partial("_ChangePasswordPartial") 15 | } 16 | else 17 | { 18 | @Html.Partial("_SetPasswordPartial") 19 | } 20 | 21 |
22 | @Html.Action("RemoveAccountList") 23 | @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl }) 24 |
25 |
26 |
27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Reset password confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 11 |

12 |
13 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Albums/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Create"; 5 | } 6 | 7 |

Create a new wonderful album!

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 |
19 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 20 |
21 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 22 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 |
31 |
32 | } 33 | 34 |
35 | @Html.ActionLink("Back to List", "Index") 36 |
37 | 38 | @section Scripts { 39 | @Scripts.Render("~/bundles/jqueryval") 40 | } 41 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Albums/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Album

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | 24 | @using (Html.BeginForm()) { 25 | @Html.AntiForgeryToken() 26 | 27 |
28 | | 29 | @Html.ActionLink("Back to List", "Index") 30 |
31 | } 32 |
33 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Albums/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Album

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Title) 19 |
20 | 21 |
22 |
23 |

24 | @Html.ActionLink("Edit", "Edit", new { id = Model.AlbumID }) | 25 | @Html.ActionLink("Back to List", "Index") 26 |

27 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Albums/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Edit"; 5 | } 6 | 7 |

Edit

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 | @Html.HiddenFor(model => model.AlbumID) 19 | 20 |
21 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 22 |
23 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 24 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 25 |
26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 | } 35 | 36 |
37 | @Html.ActionLink("Back to List", "Index") 38 |
39 | 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } 43 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Albums/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 18 | 19 | 20 | @foreach (var item in Model) { 21 | 22 | 25 | 30 | 31 | } 32 | 33 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
23 | @Html.DisplayFor(wibble => item.Title) 24 | 26 | @Html.ActionLink("Edit", "Edit", new { id=item.AlbumID }) | 27 | @Html.ActionLink("Details", "Details", new { id=item.AlbumID }) | 28 | @Html.ActionLink("Delete", "Delete", new { id=item.AlbumID }) 29 |
34 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Reviews/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Review

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Album.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Contents) 24 |
25 | 26 |
27 | @Html.DisplayFor(model => model.Contents) 28 |
29 | 30 |
31 | @Html.DisplayNameFor(model => model.ReviewerEmail) 32 |
33 | 34 |
35 | @Html.DisplayFor(model => model.ReviewerEmail) 36 |
37 | 38 |
39 | 40 | @using (Html.BeginForm()) { 41 | @Html.AntiForgeryToken() 42 | 43 |
44 | | 45 | @Html.ActionLink("Back to List", "Index") 46 |
47 | } 48 |
49 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Reviews/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Review

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Album.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Album.Title) 19 |
20 | 21 |
22 | @Html.DisplayNameFor(model => model.Contents) 23 |
24 | 25 |
26 | @Html.DisplayFor(model => model.Contents) 27 |
28 | 29 |
30 | @Html.DisplayNameFor(model => model.ReviewerEmail) 31 |
32 | 33 |
34 | @Html.DisplayFor(model => model.ReviewerEmail) 35 |
36 | 37 |
38 |
39 |

40 | @Html.ActionLink("Edit", "Edit", new { id = Model.ReviewID }) | 41 | @Html.ActionLink("Back to List", "Index") 42 |

43 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Reviews/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 37 | 42 | 43 | } 44 | 45 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 | 18 | @Html.DisplayNameFor(model => model.Contents) 19 | 21 | @Html.DisplayNameFor(model => model.ReviewerEmail) 22 |
29 | @Html.DisplayFor(modelItem => item.Album.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Contents) 33 | 35 | @Html.DisplayFor(modelItem => item.ReviewerEmail) 36 | 38 | @Html.ActionLink("Edit", "Edit", new { id=item.ReviewID }) | 39 | @Html.ActionLink("Details", "Details", new { id=item.ReviewID }) | 40 | @Html.ActionLink("Delete", "Delete", new { id=item.ReviewID }) 41 |
46 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 22 | } 23 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/favicon.ico -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 5 - Customizing Views/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Module 5 - Customizing Views/readme.txt: -------------------------------------------------------------------------------- 1 | Source code for the Introduction to ASP.NET MVC free training course on June 23, 2014 (http://www.microsoftvirtualacademy.com/liveevents/introduction-to-asp-net-mvc) -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore.Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore.Tests/Controllers/HomeControllerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.Mvc; 6 | using Microsoft.VisualStudio.TestTools.UnitTesting; 7 | using MVCMusicStore; 8 | using MVCMusicStore.Controllers; 9 | 10 | namespace MVCMusicStore.Tests.Controllers 11 | { 12 | [TestClass] 13 | public class HomeControllerTest 14 | { 15 | [TestMethod] 16 | public void Index() 17 | { 18 | // Arrange 19 | HomeController controller = new HomeController(); 20 | 21 | // Act 22 | ViewResult result = controller.Index() as ViewResult; 23 | 24 | // Assert 25 | Assert.IsNotNull(result); 26 | } 27 | 28 | [TestMethod] 29 | public void About() 30 | { 31 | // Arrange 32 | HomeController controller = new HomeController(); 33 | 34 | // Act 35 | ViewResult result = controller.About() as ViewResult; 36 | 37 | // Assert 38 | Assert.AreEqual("Your application description page.", result.ViewBag.Message); 39 | } 40 | 41 | [TestMethod] 42 | public void Contact() 43 | { 44 | // Arrange 45 | HomeController controller = new HomeController(); 46 | 47 | // Act 48 | ViewResult result = controller.Contact() as ViewResult; 49 | 50 | // Assert 51 | Assert.IsNotNull(result); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MVCMusicStore 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MVCMusicStore 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapMvcAttributeRoutes();//Attribute Routing 17 | 18 | routes.MapRoute( 19 | name: "Default", 20 | url: "{controller}/{action}/{id}", 21 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 22 | ); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace MVCMusicStore.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MVCMusicStore.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace MVCMusicStore 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Models/Album.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Album 9 | { 10 | public int AlbumID { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public Artist Artist { get; set; } 15 | 16 | public virtual List Review { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Models/Artist.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Artist 9 | { 10 | public int ArtistID { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public virtual List Albums { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Models/Review.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class Review 10 | { 11 | public int ReviewID { get; set; } 12 | 13 | [Display(Name="Album")] 14 | public int AlbumID { get; set; } 15 | public virtual Album Album { get; set; } 16 | 17 | public string Contents { get; set; } 18 | 19 | [Required()] 20 | [Display(Name="Email Address")] 21 | [DataType(DataType.EmailAddress)] 22 | public string ReviewerEmail { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Models/StoreContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class StoreContext : DbContext 10 | { 11 | public DbSet Reviews { get; set; } 12 | public DbSet Albums { get; set; } 13 | public DbSet Artists { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Scripts/_references.js -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | 4 | [assembly: OwinStartupAttribute(typeof(MVCMusicStore.Startup))] 5 | namespace MVCMusicStore 6 | { 7 | public partial class Startup 8 | { 9 | public void Configuration(IAppBuilder app) 10 | { 11 | ConfigureAuth(app); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/StoreDiagram.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AAAAAAAAAAAAAEAAAACAAAAAAIAAAAAAAACAAAAAAAA= 7 | Models\Album.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACBAAAAA= 14 | Models\Artist.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAAAAAAAAAAACAAAAAABAAAAABAAAACABAAAA= 21 | Models\Review.cs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "ConfirmAccount"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |
7 |

8 | Thank you for confirming your account. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 9 |

10 |
11 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |

Unsuccessful login with service.

7 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ForgotPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Forgot your password?"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Enter your email.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Forgot Password Confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Please check your email to reset your password. 11 |

12 |
13 | 14 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Account/Manage.cshtml: -------------------------------------------------------------------------------- 1 | @using MVCMusicStore.Models; 2 | @using Microsoft.AspNet.Identity; 3 | @{ 4 | ViewBag.Title = "Manage Account"; 5 | } 6 | 7 |

@ViewBag.Title.

8 | 9 |

@ViewBag.StatusMessage

10 |
11 |
12 | @if (ViewBag.HasLocalPassword) 13 | { 14 | @Html.Partial("_ChangePasswordPartial") 15 | } 16 | else 17 | { 18 | @Html.Partial("_SetPasswordPartial") 19 | } 20 | 21 |
22 | @Html.Action("RemoveAccountList") 23 | @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl }) 24 |
25 |
26 |
27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Reset password confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 11 |

12 |
13 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Albums/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Create"; 5 | } 6 | 7 |

Create a new wonderful album!

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 |
19 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 20 |
21 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 22 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 |
31 |
32 | } 33 | 34 |
35 | @Html.ActionLink("Back to List", "Index") 36 |
37 | 38 | @section Scripts { 39 | @Scripts.Render("~/bundles/jqueryval") 40 | } 41 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Albums/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Album

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | 24 | @using (Html.BeginForm()) { 25 | @Html.AntiForgeryToken() 26 | 27 |
28 | | 29 | @Html.ActionLink("Back to List", "Index") 30 |
31 | } 32 |
33 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Albums/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Album

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Title) 19 |
20 | 21 |
22 |
23 |

24 | @Html.ActionLink("Edit", "Edit", new { id = Model.AlbumID }) | 25 | @Html.ActionLink("Back to List", "Index") 26 |

27 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Albums/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Edit"; 5 | } 6 | 7 |

Edit

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 | @Html.HiddenFor(model => model.AlbumID) 19 | 20 |
21 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 22 |
23 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 24 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 25 |
26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 | } 35 | 36 |
37 | @Html.ActionLink("Back to List", "Index") 38 |
39 | 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } 43 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Albums/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 18 | 19 | 20 | @foreach (var item in Model) { 21 | 22 | 25 | 30 | 31 | } 32 | 33 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
23 | @Html.DisplayFor(wibble => item.Title) 24 | 26 | @Html.ActionLink("Edit", "Edit", new { id=item.AlbumID }) | 27 | @Html.ActionLink("Details", "Details", new { id=item.AlbumID }) | 28 | @Html.ActionLink("Delete", "Delete", new { id=item.AlbumID }) 29 |
34 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Reviews/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Review

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Album.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Contents) 24 |
25 | 26 |
27 | @Html.DisplayFor(model => model.Contents) 28 |
29 | 30 |
31 | @Html.DisplayNameFor(model => model.ReviewerEmail) 32 |
33 | 34 |
35 | @Html.DisplayFor(model => model.ReviewerEmail) 36 |
37 | 38 |
39 | 40 | @using (Html.BeginForm()) { 41 | @Html.AntiForgeryToken() 42 | 43 |
44 | | 45 | @Html.ActionLink("Back to List", "Index") 46 |
47 | } 48 |
49 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Reviews/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Review

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Album.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Album.Title) 19 |
20 | 21 |
22 | @Html.DisplayNameFor(model => model.Contents) 23 |
24 | 25 |
26 | @Html.DisplayFor(model => model.Contents) 27 |
28 | 29 |
30 | @Html.DisplayNameFor(model => model.ReviewerEmail) 31 |
32 | 33 |
34 | @Html.DisplayFor(model => model.ReviewerEmail) 35 |
36 | 37 |
38 |
39 |

40 | @Html.ActionLink("Edit", "Edit", new { id = Model.ReviewID }) | 41 | @Html.ActionLink("Back to List", "Index") 42 |

43 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Reviews/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 37 | 42 | 43 | } 44 | 45 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 | 18 | @Html.DisplayNameFor(model => model.Contents) 19 | 21 | @Html.DisplayNameFor(model => model.ReviewerEmail) 22 |
29 | @Html.DisplayFor(modelItem => item.Album.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Contents) 33 | 35 | @Html.DisplayFor(modelItem => item.ReviewerEmail) 36 | 38 | @Html.ActionLink("Edit", "Edit", new { id=item.ReviewID }) | 39 | @Html.ActionLink("Details", "Details", new { id=item.ReviewID }) | 40 | @Html.ActionLink("Delete", "Delete", new { id=item.ReviewID }) 41 |
46 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 22 | } 23 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/favicon.ico -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 6 - Introduction to Bootstrap/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Module 6 - Introduction to Bootstrap/readme.txt: -------------------------------------------------------------------------------- 1 | Source code for the Introduction to ASP.NET MVC free training course on June 23, 2014 (http://www.microsoftvirtualacademy.com/liveevents/introduction-to-asp-net-mvc) -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore.Tests/App.config: -------------------------------------------------------------------------------- 1 |  2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext.mdf -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Data/MVCMusicStore.Models.StoreContext_log.ldf -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Data/aspnet-MVCMusicStore-20140623095615.mdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Data/aspnet-MVCMusicStore-20140623095615.mdf -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Data/aspnet-MVCMusicStore-20140623095615_log.ldf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Data/aspnet-MVCMusicStore-20140623095615_log.ldf -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Start/FilterConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | 4 | namespace MVCMusicStore 5 | { 6 | public class FilterConfig 7 | { 8 | public static void RegisterGlobalFilters(GlobalFilterCollection filters) 9 | { 10 | filters.Add(new HandleErrorAttribute()); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/App_Start/RouteConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Routing; 7 | 8 | namespace MVCMusicStore 9 | { 10 | public class RouteConfig 11 | { 12 | public static void RegisterRoutes(RouteCollection routes) 13 | { 14 | routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 15 | 16 | routes.MapMvcAttributeRoutes();//Attribute Routing 17 | 18 | routes.MapRoute( 19 | name: "Default", 20 | url: "{controller}/{action}/{id}", 21 | defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } 22 | ); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Content/Site.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding-top: 50px; 3 | padding-bottom: 20px; 4 | } 5 | 6 | /* Set padding to keep content from hitting the edges */ 7 | .body-content { 8 | padding-left: 15px; 9 | padding-right: 15px; 10 | } 11 | 12 | /* Set width on the form input elements since they're 100% wide by default */ 13 | input, 14 | select, 15 | textarea { 16 | max-width: 280px; 17 | } 18 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Controllers/HomeController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | 7 | namespace MVCMusicStore.Controllers 8 | { 9 | public class HomeController : Controller 10 | { 11 | public ActionResult Index() 12 | { 13 | return View(); 14 | } 15 | 16 | public ActionResult About() 17 | { 18 | ViewBag.Message = "Your application description page."; 19 | 20 | return View(); 21 | } 22 | 23 | public ActionResult Contact() 24 | { 25 | ViewBag.Message = "Your contact page."; 26 | 27 | return View(); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="MVCMusicStore.MvcApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Global.asax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.Mvc; 6 | using System.Web.Optimization; 7 | using System.Web.Routing; 8 | 9 | namespace MVCMusicStore 10 | { 11 | public class MvcApplication : System.Web.HttpApplication 12 | { 13 | protected void Application_Start() 14 | { 15 | AreaRegistration.RegisterAllAreas(); 16 | FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); 17 | RouteConfig.RegisterRoutes(RouteTable.Routes); 18 | BundleConfig.RegisterBundles(BundleTable.Bundles); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Models/Album.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Album 9 | { 10 | public int AlbumID { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public Artist Artist { get; set; } 15 | 16 | public virtual List Review { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Models/Artist.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace MVCMusicStore.Models 7 | { 8 | public class Artist 9 | { 10 | public int ArtistID { get; set; } 11 | 12 | public string Name { get; set; } 13 | 14 | public virtual List Albums { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Models/Review.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel.DataAnnotations; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class Review 10 | { 11 | public int ReviewID { get; set; } 12 | 13 | [Display(Name="Album")] 14 | public int AlbumID { get; set; } 15 | public virtual Album Album { get; set; } 16 | 17 | public string Contents { get; set; } 18 | 19 | [Required()] 20 | [Display(Name="Email Address")] 21 | [DataType(DataType.EmailAddress)] 22 | public string ReviewerEmail { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Models/StoreContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data.Entity; 4 | using System.Linq; 5 | using System.Web; 6 | 7 | namespace MVCMusicStore.Models 8 | { 9 | public class StoreContext : DbContext 10 | { 11 | public DbSet Reviews { get; set; } 12 | public DbSet Albums { get; set; } 13 | public DbSet Artists { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Scripts/_references.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Scripts/_references.js -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Startup.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin; 2 | using Owin; 3 | 4 | [assembly: OwinStartupAttribute(typeof(MVCMusicStore.Startup))] 5 | namespace MVCMusicStore 6 | { 7 | public partial class Startup 8 | { 9 | public void Configuration(IAppBuilder app) 10 | { 11 | ConfigureAuth(app); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/StoreDiagram.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AAAAAAAAAAAAAEAAAACAAAAAAIAAAAAAAACAAAAAAAA= 7 | Models\Album.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAACBAAAAA= 14 | Models\Artist.cs 15 | 16 | 17 | 18 | 19 | 20 | AAAAAAAAAAAAAAAAAACAAAAAABAAAAABAAAACABAAAA= 21 | Models\Review.cs 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Account/ConfirmEmail.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "ConfirmAccount"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |
7 |

8 | Thank you for confirming your account. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 9 |

10 |
11 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Account/ExternalLoginFailure.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Login Failure"; 3 | } 4 | 5 |

@ViewBag.Title.

6 |

Unsuccessful login with service.

7 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Account/ForgotPassword.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.ForgotPasswordViewModel 2 | @{ 3 | ViewBag.Title = "Forgot your password?"; 4 | } 5 | 6 |

@ViewBag.Title.

7 | 8 | @using (Html.BeginForm("ForgotPassword", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) 9 | { 10 | @Html.AntiForgeryToken() 11 |

Enter your email.

12 |
13 | @Html.ValidationSummary("", new { @class = "text-danger" }) 14 |
15 | @Html.LabelFor(m => m.Email, new { @class = "col-md-2 control-label" }) 16 |
17 | @Html.TextBoxFor(m => m.Email, new { @class = "form-control" }) 18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | } 26 | 27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Account/ForgotPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Forgot Password Confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Please check your email to reset your password. 11 |

12 |
13 | 14 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Account/Manage.cshtml: -------------------------------------------------------------------------------- 1 | @using MVCMusicStore.Models; 2 | @using Microsoft.AspNet.Identity; 3 | @{ 4 | ViewBag.Title = "Manage Account"; 5 | } 6 | 7 |

@ViewBag.Title.

8 | 9 |

@ViewBag.StatusMessage

10 |
11 |
12 | @if (ViewBag.HasLocalPassword) 13 | { 14 | @Html.Partial("_ChangePasswordPartial") 15 | } 16 | else 17 | { 18 | @Html.Partial("_SetPasswordPartial") 19 | } 20 | 21 |
22 | @Html.Action("RemoveAccountList") 23 | @Html.Partial("_ExternalLoginsListPartial", new ExternalLoginListViewModel { Action = "LinkLogin", ReturnUrl = ViewBag.ReturnUrl }) 24 |
25 |
26 |
27 | @section Scripts { 28 | @Scripts.Render("~/bundles/jqueryval") 29 | } 30 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Account/ResetPasswordConfirmation.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Reset password confirmation"; 3 | } 4 | 5 |
6 |

@ViewBag.Title.

7 |
8 |
9 |

10 | Your password has been reset. Please @Html.ActionLink("click here to log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" }) 11 |

12 |
13 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Albums/Create.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Create"; 5 | } 6 | 7 |

Create a new wonderful album!

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 |
19 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 20 |
21 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 22 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 23 |
24 |
25 | 26 |
27 |
28 | 29 |
30 |
31 |
32 | } 33 | 34 |
35 | @Html.ActionLink("Back to List", "Index") 36 |
37 | 38 | @section Scripts { 39 | @Scripts.Render("~/bundles/jqueryval") 40 | } 41 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Albums/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Album

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Title) 20 |
21 | 22 |
23 | 24 | @using (Html.BeginForm()) { 25 | @Html.AntiForgeryToken() 26 | 27 |
28 | | 29 | @Html.ActionLink("Back to List", "Index") 30 |
31 | } 32 |
33 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Albums/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Album

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Title) 19 |
20 | 21 |
22 |
23 |

24 | @Html.ActionLink("Edit", "Edit", new { id = Model.AlbumID }) | 25 | @Html.ActionLink("Back to List", "Index") 26 |

27 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Albums/Edit.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Album 2 | 3 | @{ 4 | ViewBag.Title = "Edit"; 5 | } 6 | 7 |

Edit

8 | 9 | 10 | @using (Html.BeginForm()) 11 | { 12 | @Html.AntiForgeryToken() 13 | 14 |
15 |

Album

16 |
17 | @Html.ValidationSummary(true, "", new { @class = "text-danger" }) 18 | @Html.HiddenFor(model => model.AlbumID) 19 | 20 |
21 | @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" }) 22 |
23 | @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } }) 24 | @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" }) 25 |
26 |
27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 | } 35 | 36 |
37 | @Html.ActionLink("Back to List", "Index") 38 |
39 | 40 | @section Scripts { 41 | @Scripts.Render("~/bundles/jqueryval") 42 | } 43 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Albums/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 18 | 19 | 20 | @foreach (var item in Model) { 21 | 22 | 25 | 30 | 31 | } 32 | 33 |
15 | @Html.DisplayNameFor(model => model.Title) 16 |
23 | @Html.DisplayFor(wibble => item.Title) 24 | 26 | @Html.ActionLink("Edit", "Edit", new { id=item.AlbumID }) | 27 | @Html.ActionLink("Details", "Details", new { id=item.AlbumID }) | 28 | @Html.ActionLink("Delete", "Delete", new { id=item.AlbumID }) 29 |
34 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Home/About.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "About"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |

Use this area to provide additional information.

8 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Home/Contact.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | ViewBag.Title = "Contact"; 3 | } 4 |

@ViewBag.Title.

5 |

@ViewBag.Message

6 | 7 |
8 | One Microsoft Way
9 | Redmond, WA 98052-6399
10 | P: 11 | 425.555.0100 12 |
13 | 14 |
15 | Support: Support@example.com
16 | Marketing: Marketing@example.com 17 |
-------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Reviews/Delete.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Delete"; 5 | } 6 | 7 |

Delete

8 | 9 |

Are you sure you want to delete this?

10 |
11 |

Review

12 |
13 |
14 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 |
17 | 18 |
19 | @Html.DisplayFor(model => model.Album.Title) 20 |
21 | 22 |
23 | @Html.DisplayNameFor(model => model.Contents) 24 |
25 | 26 |
27 | @Html.DisplayFor(model => model.Contents) 28 |
29 | 30 |
31 | @Html.DisplayNameFor(model => model.ReviewerEmail) 32 |
33 | 34 |
35 | @Html.DisplayFor(model => model.ReviewerEmail) 36 |
37 | 38 |
39 | 40 | @using (Html.BeginForm()) { 41 | @Html.AntiForgeryToken() 42 | 43 |
44 | | 45 | @Html.ActionLink("Back to List", "Index") 46 |
47 | } 48 |
49 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Reviews/Details.cshtml: -------------------------------------------------------------------------------- 1 | @model MVCMusicStore.Models.Review 2 | 3 | @{ 4 | ViewBag.Title = "Details"; 5 | } 6 | 7 |

Details

8 | 9 |
10 |

Review

11 |
12 |
13 |
14 | @Html.DisplayNameFor(model => model.Album.Title) 15 |
16 | 17 |
18 | @Html.DisplayFor(model => model.Album.Title) 19 |
20 | 21 |
22 | @Html.DisplayNameFor(model => model.Contents) 23 |
24 | 25 |
26 | @Html.DisplayFor(model => model.Contents) 27 |
28 | 29 |
30 | @Html.DisplayNameFor(model => model.ReviewerEmail) 31 |
32 | 33 |
34 | @Html.DisplayFor(model => model.ReviewerEmail) 35 |
36 | 37 |
38 |
39 |

40 | @Html.ActionLink("Edit", "Edit", new { id = Model.ReviewID }) | 41 | @Html.ActionLink("Back to List", "Index") 42 |

43 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Reviews/Index.cshtml: -------------------------------------------------------------------------------- 1 | @model IEnumerable 2 | 3 | @{ 4 | ViewBag.Title = "Index"; 5 | } 6 | 7 |

Index

8 | 9 |

10 | @Html.ActionLink("Create New", "Create") 11 |

12 | 13 | 14 | 17 | 20 | 23 | 24 | 25 | 26 | @foreach (var item in Model) { 27 | 28 | 31 | 34 | 37 | 42 | 43 | } 44 | 45 |
15 | @Html.DisplayNameFor(model => model.Album.Title) 16 | 18 | @Html.DisplayNameFor(model => model.Contents) 19 | 21 | @Html.DisplayNameFor(model => model.ReviewerEmail) 22 |
29 | @Html.DisplayFor(modelItem => item.Album.Title) 30 | 32 | @Html.DisplayFor(modelItem => item.Contents) 33 | 35 | @Html.DisplayFor(modelItem => item.ReviewerEmail) 36 | 38 | @Html.ActionLink("Edit", "Edit", new { id=item.ReviewID }) | 39 | @Html.ActionLink("Details", "Details", new { id=item.ReviewID }) | 40 | @Html.ActionLink("Delete", "Delete", new { id=item.ReviewID }) 41 |
46 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Shared/Error.cshtml: -------------------------------------------------------------------------------- 1 | @model System.Web.Mvc.HandleErrorInfo 2 | 3 | @{ 4 | ViewBag.Title = "Error"; 5 | } 6 | 7 |

Error.

8 |

An error occurred while processing your request.

9 | 10 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/Shared/_LoginPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using Microsoft.AspNet.Identity 2 | @if (Request.IsAuthenticated) 3 | { 4 | using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" })) 5 | { 6 | @Html.AntiForgeryToken() 7 | 8 | 14 | } 15 | } 16 | else 17 | { 18 | 22 | } 23 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/Views/_ViewStart.cshtml: -------------------------------------------------------------------------------- 1 | @{ 2 | Layout = "~/Views/Shared/_Layout.cshtml"; 3 | } 4 | -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/favicon.ico -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jongalloway/MVA-Introduction-to-ASPNET-MVC/6c2de43854c7272b2566655cab73d69a23f5312b/Module 7 - Introduction to Authentication/MVCMusicStore/MVCMusicStore/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /Module 7 - Introduction to Authentication/readme.txt: -------------------------------------------------------------------------------- 1 | Source code for the Introduction to ASP.NET MVC free training course on June 23, 2014 (http://www.microsoftvirtualacademy.com/liveevents/introduction-to-asp-net-mvc) --------------------------------------------------------------------------------