Skip to content

Commit 76b470a

Browse files
committed
Added Module 6 code
1 parent 8637a0c commit 76b470a

File tree

94 files changed

+29625
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+29625
-24
lines changed

MVCMusicStore/MVCMusicStore/Content/bootstrap.min.css

+7-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MVCMusicStore/MVCMusicStore/Views/Home/Index.cshtml

+17-4
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,26 @@
33
}
44

55
<div class="jumbotron">
6-
<h1>ASP.NET</h1>
6+
<h1>ASP.NET <span class="glyphicon glyphicon-shopping-cart">Cart</span></h1>
77
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
88
<p><a href="http://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>
9+
<a href="#" class="btn btn-success"><span class="glyphicon glyphicon-shopping-cart">Cart</span> Buy now!!!</a>
910
</div>
1011

12+
13+
14+
<ul class="pagination">
15+
<li><a href="#">&laquo;</a></li>
16+
<li><a href="#">1</a></li>
17+
<li><a href="#">2</a></li>
18+
<li><a href="#">3</a></li>
19+
<li><a href="#">4</a></li>
20+
<li><a href="#">5</a></li>
21+
<li><a href="#">&raquo;</a></li>
22+
</ul>
23+
1124
<div class="row">
12-
<div class="col-md-4">
25+
<div class="col-md-6 col-sm-2">
1326
<h2>Getting started</h2>
1427
<p>
1528
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
@@ -18,12 +31,12 @@
1831
</p>
1932
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p>
2033
</div>
21-
<div class="col-md-4">
34+
<div class="col-md-4 col-sm-2">
2235
<h2>Get more libraries</h2>
2336
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
2437
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p>
2538
</div>
26-
<div class="col-md-4">
39+
<div class="col-md-2 col-sm-8">
2740
<h2>Web Hosting</h2>
2841
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
2942
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p>

Module 4 - Customizing Controllers/MVCMusicStore/Controllers/AlbumsController.cs

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ public ActionResult Index()
3131
return View(albums);
3232
}
3333

34+
public ActionResult AlbumWithReviews(int id)
35+
{
36+
return View();
37+
}
38+
3439
// GET: Albums/Details/5
3540
[Route("Album/{id:int}")]
3641
public ActionResult Details(int? id)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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<string> ReviewContent { get; set; }
12+
}
13+
}
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!--
3+
Note: Add entries to the App.config file for configuration settings
4+
that apply only to the Test project.
5+
-->
6+
<configuration>
7+
<appSettings>
8+
9+
</appSettings>
10+
11+
<connectionStrings>
12+
13+
</connectionStrings>
14+
</configuration>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>
7+
</ProductVersion>
8+
<SchemaVersion>2.0</SchemaVersion>
9+
<ProjectGuid>{80CD1024-7400-47A8-8F3D-46DA1DDA5DBA}</ProjectGuid>
10+
<OutputType>Library</OutputType>
11+
<AppDesignerFolder>Properties</AppDesignerFolder>
12+
<RootNamespace>MVCMusicStore.Tests</RootNamespace>
13+
<AssemblyName>MVCMusicStore.Tests</AssemblyName>
14+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
15+
<FileAlignment>512</FileAlignment>
16+
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
17+
</PropertyGroup>
18+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
19+
<DebugSymbols>true</DebugSymbols>
20+
<DebugType>full</DebugType>
21+
<Optimize>false</Optimize>
22+
<OutputPath>bin\Debug\</OutputPath>
23+
<DefineConstants>DEBUG;TRACE</DefineConstants>
24+
<ErrorReport>prompt</ErrorReport>
25+
<WarningLevel>4</WarningLevel>
26+
</PropertyGroup>
27+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="Microsoft.CSharp" />
37+
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
38+
<Reference Include="System" />
39+
<Reference Include="System.ComponentModel.DataAnnotations" />
40+
<Reference Include="System.Configuration" />
41+
<Reference Include="System.Core" />
42+
<Reference Include="System.Data" />
43+
<Reference Include="System.Web" />
44+
<Reference Include="System.Web.ApplicationServices" />
45+
<Reference Include="System.Web.Extensions" />
46+
<Reference Include="System.Web.Abstractions" />
47+
<Reference Include="System.Web.Routing" />
48+
<Reference Include="System.Xml" />
49+
<Reference Include="System.Xml.Linq" />
50+
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
51+
<Private>True</Private>
52+
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
53+
</Reference>
54+
<Reference Include="Newtonsoft.Json">
55+
<HintPath>..\packages\Newtonsoft.Json.5.0.6\lib\net45\Newtonsoft.Json.dll</HintPath>
56+
</Reference>
57+
<Reference Include="System.Net.Http" />
58+
<Reference Include="System.Net.Http.WebRequest" />
59+
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
60+
<Private>True</Private>
61+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.Helpers.dll</HintPath>
62+
</Reference>
63+
<Reference Include="System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
64+
<Private>True</Private>
65+
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.1.2\lib\net45\System.Web.Mvc.dll</HintPath>
66+
</Reference>
67+
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
68+
<Private>True</Private>
69+
<HintPath>..\packages\Microsoft.AspNet.Razor.3.1.2\lib\net45\System.Web.Razor.dll</HintPath>
70+
</Reference>
71+
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
72+
<Private>True</Private>
73+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.dll</HintPath>
74+
</Reference>
75+
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
76+
<Private>True</Private>
77+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
78+
</Reference>
79+
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
80+
<Private>True</Private>
81+
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
82+
</Reference>
83+
</ItemGroup>
84+
<ItemGroup>
85+
<Compile Include="Properties\AssemblyInfo.cs" />
86+
<Compile Include="Controllers\HomeControllerTest.cs" />
87+
</ItemGroup>
88+
<ItemGroup>
89+
<Content Include="App.config" />
90+
</ItemGroup>
91+
<ItemGroup>
92+
<None Include="packages.config" />
93+
</ItemGroup>
94+
<ItemGroup>
95+
<ProjectReference Include="..\MVCMusicStore\MVCMusicStore.csproj">
96+
<Project>{05F5C509-CC1B-449F-AB64-DD38C40B91A3}</Project>
97+
<Name>MVCMusicStore</Name>
98+
</ProjectReference>
99+
</ItemGroup>
100+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
101+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
102+
Other similar extension points exist, see Microsoft.Common.targets.
103+
<Target Name="BeforeBuild">
104+
</Target>
105+
<Target Name="AfterBuild">
106+
</Target>
107+
-->
108+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("MVCMusicStore.Tests")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("MVCMusicStore.Tests")]
13+
[assembly: AssemblyCopyright("Copyright © 2014")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("3a28286c-31b3-4101-9d6a-f14b1fce46f7")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Revision and Build Numbers
33+
// by using the '*' as shown below:
34+
[assembly: AssemblyVersion("1.0.0.0")]
35+
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Microsoft.AspNet.Mvc" version="5.1.2" targetFramework="net45" />
4+
<package id="Microsoft.AspNet.Razor" version="3.1.2" targetFramework="net45" />
5+
<package id="Microsoft.AspNet.WebPages" version="3.1.2" targetFramework="net45" />
6+
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
7+
<package id="Newtonsoft.Json" version="5.0.6" targetFramework="net45" />
8+
</packages>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2013
4+
VisualStudioVersion = 12.0.30501.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVCMusicStore", "MVCMusicStore\MVCMusicStore.csproj", "{05F5C509-CC1B-449F-AB64-DD38C40B91A3}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MVCMusicStore.Tests", "MVCMusicStore.Tests\MVCMusicStore.Tests.csproj", "{80CD1024-7400-47A8-8F3D-46DA1DDA5DBA}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{05F5C509-CC1B-449F-AB64-DD38C40B91A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{05F5C509-CC1B-449F-AB64-DD38C40B91A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{05F5C509-CC1B-449F-AB64-DD38C40B91A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{05F5C509-CC1B-449F-AB64-DD38C40B91A3}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{80CD1024-7400-47A8-8F3D-46DA1DDA5DBA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{80CD1024-7400-47A8-8F3D-46DA1DDA5DBA}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{80CD1024-7400-47A8-8F3D-46DA1DDA5DBA}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{80CD1024-7400-47A8-8F3D-46DA1DDA5DBA}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System.Web;
2+
using System.Web.Optimization;
3+
4+
namespace MVCMusicStore
5+
{
6+
public class BundleConfig
7+
{
8+
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
9+
public static void RegisterBundles(BundleCollection bundles)
10+
{
11+
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
12+
"~/Scripts/jquery-{version}.js"));
13+
14+
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
15+
"~/Scripts/jquery.validate*"));
16+
17+
// Use the development version of Modernizr to develop with and learn from. Then, when you're
18+
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
19+
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
20+
"~/Scripts/modernizr-*"));
21+
22+
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
23+
"~/Scripts/bootstrap.js",
24+
"~/Scripts/respond.js"));
25+
26+
bundles.Add(new StyleBundle("~/Content/css").Include(
27+
"~/Content/bootstrap.css",
28+
"~/Content/site.css"));
29+
30+
// Set EnableOptimizations to false for debugging. For more information,
31+
// visit http://go.microsoft.com/fwlink/?LinkId=301862
32+
BundleTable.EnableOptimizations = true;
33+
}
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
}

0 commit comments

Comments
 (0)