init
This commit is contained in:
330
.gitignore
vendored
Normal file
330
.gitignore
vendored
Normal file
@@ -0,0 +1,330 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
**/Properties/launchSettings.json
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
13
ContosoUniversity.DAL/App.config
Normal file
13
ContosoUniversity.DAL/App.config
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
</configuration>
|
||||
75
ContosoUniversity.DAL/ContosoUniversity.DAL.csproj
Normal file
75
ContosoUniversity.DAL/ContosoUniversity.DAL.csproj
Normal file
@@ -0,0 +1,75 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{4B2BE745-7993-451E-BA68-7B6C1D536802}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ContosoUniversity.DAL</RootNamespace>
|
||||
<AssemblyName>ContosoUniversity.DAL</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SchoolConfiguration.cs" />
|
||||
<Compile Include="SchoolContext.cs" />
|
||||
<Compile Include="SchoolInitializer.cs" />
|
||||
<Compile Include="SchoolInterceptorLogging.cs" />
|
||||
<Compile Include="SchoolInterceptorTransientErrors.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ContosoUniversity.Logging\ContosoUniversity.Logging.csproj">
|
||||
<Project>{ae7e2487-4f2f-49f8-b9c2-96b11bb8ea76}</Project>
|
||||
<Name>ContosoUniversity.Logging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ContosoUniversity.Models\ContosoUniversity.Models.csproj">
|
||||
<Project>{2627d24e-56a3-427f-be01-a9f7aa084b1f}</Project>
|
||||
<Name>ContosoUniversity.Models</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
96
ContosoUniversity.DAL/Migrations/Configuration.cs
Normal file
96
ContosoUniversity.DAL/Migrations/Configuration.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
using System.Collections.Generic;
|
||||
using ContosoUniversity.Models;
|
||||
|
||||
namespace ContosoUniversity.DAL.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Linq;
|
||||
|
||||
internal sealed class Configuration : DbMigrationsConfiguration<ContosoUniversity.DAL.SchoolContext>
|
||||
{
|
||||
public Configuration()
|
||||
{
|
||||
AutomaticMigrationsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void Seed(ContosoUniversity.DAL.SchoolContext context)
|
||||
{
|
||||
// This method will be called after migrating to the latest version.
|
||||
|
||||
// You can use the DbSet<T>.AddOrUpdate() helper extension method
|
||||
// to avoid creating duplicate seed data. E.g.
|
||||
//
|
||||
// context.People.AddOrUpdate(
|
||||
// p => p.FullName,
|
||||
// new Person { FullName = "Andrew Peters" },
|
||||
// new Person { FullName = "Brice Lambson" },
|
||||
// new Person { FullName = "Rowan Miller" }
|
||||
// );
|
||||
//
|
||||
var instructors = new List<Instructor>
|
||||
{
|
||||
new Instructor
|
||||
{
|
||||
FirstMidName = "Kim", LastName = "Abercrombie", HireDate = DateTime.Parse("1995-03-11"),
|
||||
OfficeAssignment = new OfficeAssignment {Location = "Smith 17"}
|
||||
},
|
||||
new Instructor
|
||||
{
|
||||
FirstMidName = "Fadi", LastName = "Fakhouri", HireDate = DateTime.Parse("2002-07-06"),
|
||||
OfficeAssignment = new OfficeAssignment {Location = "Gowan 27"}
|
||||
},
|
||||
new Instructor
|
||||
{
|
||||
FirstMidName = "Roger", LastName = "Harui", HireDate = DateTime.Parse("1998-07-01"),
|
||||
OfficeAssignment = new OfficeAssignment {Location = "Thompson 304"}
|
||||
},
|
||||
new Instructor {FirstMidName = "Candace", LastName = "Kapoor", HireDate = DateTime.Parse("2001-01-15")},
|
||||
new Instructor {FirstMidName = "Roger", LastName = "Zheng", HireDate = DateTime.Parse("2004-02-12")}
|
||||
};
|
||||
|
||||
instructors.ForEach(s => context.Instructors.AddOrUpdate(i => i.LastName, s));
|
||||
context.SaveChanges();
|
||||
|
||||
var departments = new List<Department>
|
||||
{
|
||||
new Department
|
||||
{Name = "English", Budget = 350000, StartDate = DateTime.Parse("2007-09-01"), DepartmentID = 1},
|
||||
new Department
|
||||
{Name = "Mathematics", Budget = 100000, StartDate = DateTime.Parse("2007-09-01"), DepartmentID = 2},
|
||||
new Department
|
||||
{Name = "Engineering", Budget = 350000, StartDate = DateTime.Parse("2007-09-01"), DepartmentID = 3},
|
||||
new Department
|
||||
{Name = "Economics", Budget = 100000, StartDate = DateTime.Parse("2007-09-01"), DepartmentID = 4}
|
||||
};
|
||||
|
||||
departments.ForEach(s=>context.Departments.AddOrUpdate(d=>d.Name, s));
|
||||
context.SaveChanges();
|
||||
|
||||
var courses = new List<Course>
|
||||
{
|
||||
new Course {CourseID = 1050, Title = "Chemistry", Credits = 3, DepartmentID = 3},
|
||||
new Course {CourseID = 4022, Title = "Microeconomics", Credits = 3, DepartmentID = 4},
|
||||
new Course {CourseID = 4041, Title = "Macroeconomics", Credits = 3, DepartmentID = 4},
|
||||
new Course {CourseID = 1045, Title = "Calculus", Credits = 4, DepartmentID = 2},
|
||||
new Course {CourseID = 3141, Title = "Trigonometry", Credits = 4, DepartmentID = 2},
|
||||
new Course {CourseID = 2021, Title = "Composition", Credits = 3, DepartmentID = 1},
|
||||
new Course {CourseID = 2042, Title = "Literature", Credits = 4, DepartmentID = 1}
|
||||
};
|
||||
|
||||
courses.ForEach(s=>context.Courses.AddOrUpdate(s));
|
||||
context.SaveChanges();
|
||||
|
||||
courses[0].Instructors.Add(instructors[0]);
|
||||
courses[0].Instructors.Add(instructors[1]);
|
||||
courses[1].Instructors.Add(instructors[2]);
|
||||
courses[2].Instructors.Add(instructors[2]);
|
||||
courses[3].Instructors.Add(instructors[3]);
|
||||
courses[4].Instructors.Add(instructors[3]);
|
||||
courses[5].Instructors.Add(instructors[3]);
|
||||
courses[6].Instructors.Add(instructors[3]);
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
ContosoUniversity.DAL/Properties/AssemblyInfo.cs
Normal file
36
ContosoUniversity.DAL/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 組件的一般資訊是由下列的屬性集控制。
|
||||
// 變更這些屬性的值即可修改組件的相關
|
||||
// 資訊。
|
||||
[assembly: AssemblyTitle("ContosoUniversity.DAL")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ContosoUniversity.DAL")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 將 ComVisible 設為 false 可對 COM 元件隱藏
|
||||
// 組件中的類型。若必須從 COM 存取此組件中的類型,
|
||||
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
|
||||
[assembly: Guid("4b2be745-7993-451e-ba68-7b6c1d536802")]
|
||||
|
||||
// 組件的版本資訊由下列四個值所組成:
|
||||
//
|
||||
// 主要版本
|
||||
// 次要版本
|
||||
// 組建編號
|
||||
// 修訂編號
|
||||
//
|
||||
// 您可以指定所有的值,或將組建編號或修訂編號設為預設值
|
||||
//方法是使用 '*',如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
13
ContosoUniversity.DAL/SchoolConfiguration.cs
Normal file
13
ContosoUniversity.DAL/SchoolConfiguration.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.SqlServer;
|
||||
|
||||
namespace ContosoUniversity.DAL
|
||||
{
|
||||
public class SchoolConfiguration : DbConfiguration
|
||||
{
|
||||
public SchoolConfiguration()
|
||||
{
|
||||
SetExecutionStrategy("System.Data.SqlClient", () => new SqlAzureExecutionStrategy());
|
||||
}
|
||||
}
|
||||
}
|
||||
30
ContosoUniversity.DAL/SchoolContext.cs
Normal file
30
ContosoUniversity.DAL/SchoolContext.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using ContosoUniversity.Models;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.ModelConfiguration.Conventions;
|
||||
|
||||
namespace ContosoUniversity.DAL
|
||||
{
|
||||
public class SchoolContext : DbContext
|
||||
{
|
||||
public DbSet<Course> Courses { get; set; }
|
||||
public DbSet<Department> Departments { get; set; }
|
||||
public DbSet<Enrollment> Enrollments { get; set; }
|
||||
public DbSet<Instructor> Instructors { get; set; }
|
||||
public DbSet<Student> Students { get; set; }
|
||||
public DbSet<OfficeAssignment> OfficeAssignments { get; set; }
|
||||
public DbSet<Person> People { get; set; }
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
|
||||
|
||||
modelBuilder.Entity<Course>()
|
||||
.HasMany(c => c.Instructors).WithMany(i => i.Courses)
|
||||
.Map(t => t.MapLeftKey("CourseID")
|
||||
.MapRightKey("InstructorID")
|
||||
.ToTable("CourseInstructor"));
|
||||
|
||||
modelBuilder.Entity<Department>().MapToStoredProcedures();
|
||||
}
|
||||
}
|
||||
}
|
||||
59
ContosoUniversity.DAL/SchoolInitializer.cs
Normal file
59
ContosoUniversity.DAL/SchoolInitializer.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Data.Entity;
|
||||
using ContosoUniversity.Models;
|
||||
|
||||
namespace ContosoUniversity.DAL
|
||||
{
|
||||
public class SchoolInitializer : System.Data.Entity.DropCreateDatabaseIfModelChanges<SchoolContext>
|
||||
{
|
||||
protected override void Seed(SchoolContext context)
|
||||
{
|
||||
var students = new List<Student>
|
||||
{
|
||||
new Student{FirstMidName="Carson",LastName="Alexander",EnrollmentDate=DateTime.Parse("2005-09-01")},
|
||||
new Student{FirstMidName="Meredith",LastName="Alonso",EnrollmentDate=DateTime.Parse("2002-09-01")},
|
||||
new Student{FirstMidName="Arturo",LastName="Anand",EnrollmentDate=DateTime.Parse("2003-09-01")},
|
||||
new Student{FirstMidName="Gytis",LastName="Barzdukas",EnrollmentDate=DateTime.Parse("2002-09-01")},
|
||||
new Student{FirstMidName="Yan",LastName="Li",EnrollmentDate=DateTime.Parse("2002-09-01")},
|
||||
new Student{FirstMidName="Peggy",LastName="Justice",EnrollmentDate=DateTime.Parse("2001-09-01")},
|
||||
new Student{FirstMidName="Laura",LastName="Norman",EnrollmentDate=DateTime.Parse("2003-09-01")},
|
||||
new Student{FirstMidName="Nino",LastName="Olivetto",EnrollmentDate=DateTime.Parse("2005-09-01")}
|
||||
};
|
||||
|
||||
students.ForEach(s => context.Students.Add(s));
|
||||
context.SaveChanges();
|
||||
var courses = new List<Course>
|
||||
{
|
||||
new Course{CourseID=1050,Title="Chemistry",Credits=3,},
|
||||
new Course{CourseID=4022,Title="Microeconomics",Credits=3,},
|
||||
new Course{CourseID=4041,Title="Macroeconomics",Credits=3,},
|
||||
new Course{CourseID=1045,Title="Calculus",Credits=4,},
|
||||
new Course{CourseID=3141,Title="Trigonometry",Credits=4,},
|
||||
new Course{CourseID=2021,Title="Composition",Credits=3,},
|
||||
new Course{CourseID=2042,Title="Literature",Credits=4,}
|
||||
};
|
||||
courses.ForEach(s => context.Courses.Add(s));
|
||||
context.SaveChanges();
|
||||
var enrollments = new List<Enrollment>
|
||||
{
|
||||
new Enrollment{StudentID=1,CourseID=1050,Grade=Grade.A},
|
||||
new Enrollment{StudentID=1,CourseID=4022,Grade=Grade.C},
|
||||
new Enrollment{StudentID=1,CourseID=4041,Grade=Grade.B},
|
||||
new Enrollment{StudentID=2,CourseID=1045,Grade=Grade.B},
|
||||
new Enrollment{StudentID=2,CourseID=3141,Grade=Grade.F},
|
||||
new Enrollment{StudentID=2,CourseID=2021,Grade=Grade.F},
|
||||
new Enrollment{StudentID=3,CourseID=1050},
|
||||
new Enrollment{StudentID=4,CourseID=1050,},
|
||||
new Enrollment{StudentID=4,CourseID=4022,Grade=Grade.F},
|
||||
new Enrollment{StudentID=5,CourseID=4041,Grade=Grade.C},
|
||||
new Enrollment{StudentID=6,CourseID=1045},
|
||||
new Enrollment{StudentID=7,CourseID=3141,Grade=Grade.A},
|
||||
};
|
||||
enrollments.ForEach(s => context.Enrollments.Add(s));
|
||||
context.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
78
ContosoUniversity.DAL/SchoolInterceptorLogging.cs
Normal file
78
ContosoUniversity.DAL/SchoolInterceptorLogging.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure.Interception;
|
||||
using System.Data.Entity.SqlServer;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using ContosoUniversity.Logging;
|
||||
|
||||
namespace ContosoUniversity.DAL
|
||||
{
|
||||
public class SchoolInterceptorLogging : DbCommandInterceptor
|
||||
{
|
||||
private ILogger _logger = new Logger();
|
||||
private readonly Stopwatch _stopwatch = new Stopwatch();
|
||||
|
||||
public override void ScalarExecuting(DbCommand command, DbCommandInterceptionContext<object> interceptionContext)
|
||||
{
|
||||
base.ScalarExecuting(command, interceptionContext);
|
||||
_stopwatch.Restart();
|
||||
}
|
||||
|
||||
public override void ScalarExecuted(DbCommand command, DbCommandInterceptionContext<object> interceptionContext)
|
||||
{
|
||||
_stopwatch.Stop();
|
||||
if (interceptionContext.Exception != null)
|
||||
{
|
||||
_logger.Error(interceptionContext.Exception, "Error executing command: {0}", command.CommandText);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.TraceApi("SQL Database", "SchoolInterceptor.ScalarExecuted", _stopwatch.Elapsed, "Command: {0}: ", command.CommandText);
|
||||
}
|
||||
base.ScalarExecuted(command, interceptionContext);
|
||||
}
|
||||
|
||||
public override void NonQueryExecuting(DbCommand command, DbCommandInterceptionContext<int> interceptionContext)
|
||||
{
|
||||
base.NonQueryExecuting(command, interceptionContext);
|
||||
_stopwatch.Restart();
|
||||
}
|
||||
|
||||
public override void NonQueryExecuted(DbCommand command, DbCommandInterceptionContext<int> interceptionContext)
|
||||
{
|
||||
_stopwatch.Stop();
|
||||
if (interceptionContext.Exception != null)
|
||||
{
|
||||
_logger.Error(interceptionContext.Exception, "Error executing command: {0}", command.CommandText);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.TraceApi("SQL Database", "SchoolInterceptor.NonQueryExecuted", _stopwatch.Elapsed, "Command: {0}: ", command.CommandText);
|
||||
}
|
||||
base.NonQueryExecuted(command, interceptionContext);
|
||||
}
|
||||
|
||||
public override void ReaderExecuting(DbCommand command, DbCommandInterceptionContext<DbDataReader> interceptionContext)
|
||||
{
|
||||
base.ReaderExecuting(command, interceptionContext);
|
||||
_stopwatch.Restart();
|
||||
}
|
||||
public override void ReaderExecuted(DbCommand command, DbCommandInterceptionContext<DbDataReader> interceptionContext)
|
||||
{
|
||||
_stopwatch.Stop();
|
||||
if (interceptionContext.Exception != null)
|
||||
{
|
||||
_logger.Error(interceptionContext.Exception, "Error executing command: {0}", command.CommandText);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.TraceApi("SQL Database", "SchoolInterceptor.ReaderExecuted", _stopwatch.Elapsed, "Command: {0}: ", command.CommandText);
|
||||
}
|
||||
base.ReaderExecuted(command, interceptionContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
55
ContosoUniversity.DAL/SchoolInterceptorTransientErrors.cs
Normal file
55
ContosoUniversity.DAL/SchoolInterceptorTransientErrors.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Data.Common;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Infrastructure.Interception;
|
||||
using System.Data.Entity.SqlServer;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
using System.Linq;
|
||||
using ContosoUniversity.Logging;
|
||||
|
||||
namespace ContosoUniversity.DAL
|
||||
{
|
||||
public class SchoolInterceptorTransientErrors : DbCommandInterceptor
|
||||
{
|
||||
private int _counter = 0;
|
||||
private ILogger _logger = new Logger();
|
||||
|
||||
public override void ReaderExecuting(DbCommand command, DbCommandInterceptionContext<DbDataReader> interceptionContext)
|
||||
{
|
||||
bool throwTransientErrors = false;
|
||||
if (command.Parameters.Count > 0 && command.Parameters[0].Value.ToString() == "%Throw%")
|
||||
{
|
||||
throwTransientErrors = true;
|
||||
command.Parameters[0].Value = "%an%";
|
||||
command.Parameters[1].Value = "%an%";
|
||||
}
|
||||
|
||||
if (throwTransientErrors && _counter < 4)
|
||||
{
|
||||
_logger.Information("Returning transient error for command: {0}", command.CommandText);
|
||||
_counter++;
|
||||
interceptionContext.Exception = CreateDummySqlException();
|
||||
}
|
||||
}
|
||||
|
||||
private SqlException CreateDummySqlException()
|
||||
{
|
||||
// The instance of SQL Server you attempted to connect to does not support encryption
|
||||
var sqlErrorNumber = 20;
|
||||
|
||||
var sqlErrorCtor = typeof(SqlError).GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic).Where(c => c.GetParameters().Count() == 7).Single();
|
||||
var sqlError = sqlErrorCtor.Invoke(new object[] { sqlErrorNumber, (byte)0, (byte)0, "", "", "", 1 });
|
||||
|
||||
var errorCollection = Activator.CreateInstance(typeof(SqlErrorCollection), true);
|
||||
var addMethod = typeof(SqlErrorCollection).GetMethod("Add", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
addMethod.Invoke(errorCollection, new[] { sqlError });
|
||||
|
||||
var sqlExceptionCtor = typeof(SqlException).GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic).Where(c => c.GetParameters().Count() == 4).Single();
|
||||
var sqlException = (SqlException)sqlExceptionCtor.Invoke(new object[] { "Dummy", errorCollection, null, Guid.NewGuid() });
|
||||
|
||||
return sqlException;
|
||||
}
|
||||
}
|
||||
}
|
||||
4
ContosoUniversity.DAL/packages.config
Normal file
4
ContosoUniversity.DAL/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.1.1" targetFramework="net45" />
|
||||
</packages>
|
||||
50
ContosoUniversity.Logging/ContosoUniversity.Logging.csproj
Normal file
50
ContosoUniversity.Logging/ContosoUniversity.Logging.csproj
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AE7E2487-4F2F-49F8-B9C2-96B11BB8EA76}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ContosoUniversity.Logging</RootNamespace>
|
||||
<AssemblyName>ContosoUniversity.Logging</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ILogger.cs" />
|
||||
<Compile Include="Logger.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
24
ContosoUniversity.Logging/ILogger.cs
Normal file
24
ContosoUniversity.Logging/ILogger.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace ContosoUniversity.Logging
|
||||
{
|
||||
public interface ILogger
|
||||
{
|
||||
void Information(string message);
|
||||
void Information(string fmt, params object[] vars);
|
||||
void Information(Exception exception, string fmt, params object[] vars);
|
||||
|
||||
void Warning(string message);
|
||||
void Warning(string fmt, params object[] vars);
|
||||
void Warning(Exception exception, string fmt, params object[] vars);
|
||||
|
||||
void Error(string message);
|
||||
void Error(string fmt, params object[] vars);
|
||||
void Error(Exception exception, string fmt, params object[] vars);
|
||||
|
||||
void TraceApi(string componentName, string method, TimeSpan timespan);
|
||||
void TraceApi(string componentName, string method, TimeSpan timespan, string properties);
|
||||
void TraceApi(string componentName, string method, TimeSpan timespan, string fmt, params object[] vars);
|
||||
|
||||
}
|
||||
}
|
||||
81
ContosoUniversity.Logging/Logger.cs
Normal file
81
ContosoUniversity.Logging/Logger.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace ContosoUniversity.Logging
|
||||
{
|
||||
public class Logger : ILogger
|
||||
{
|
||||
|
||||
public void Information(string message)
|
||||
{
|
||||
Trace.TraceInformation(message);
|
||||
}
|
||||
|
||||
public void Information(string fmt, params object[] vars)
|
||||
{
|
||||
Trace.TraceInformation(fmt, vars);
|
||||
}
|
||||
|
||||
public void Information(Exception exception, string fmt, params object[] vars)
|
||||
{
|
||||
Trace.TraceInformation(FormatExceptionMessage(exception, fmt, vars));
|
||||
}
|
||||
|
||||
public void Warning(string message)
|
||||
{
|
||||
Trace.TraceWarning(message);
|
||||
}
|
||||
|
||||
public void Warning(string fmt, params object[] vars)
|
||||
{
|
||||
Trace.TraceWarning(fmt, vars);
|
||||
}
|
||||
|
||||
public void Warning(Exception exception, string fmt, params object[] vars)
|
||||
{
|
||||
Trace.TraceWarning(FormatExceptionMessage(exception, fmt, vars));
|
||||
}
|
||||
|
||||
public void Error(string message)
|
||||
{
|
||||
Trace.TraceError(message);
|
||||
}
|
||||
|
||||
public void Error(string fmt, params object[] vars)
|
||||
{
|
||||
Trace.TraceError(fmt, vars);
|
||||
}
|
||||
|
||||
public void Error(Exception exception, string fmt, params object[] vars)
|
||||
{
|
||||
Trace.TraceError(FormatExceptionMessage(exception, fmt, vars));
|
||||
}
|
||||
|
||||
public void TraceApi(string componentName, string method, TimeSpan timespan)
|
||||
{
|
||||
TraceApi(componentName, method, timespan, "");
|
||||
}
|
||||
|
||||
public void TraceApi(string componentName, string method, TimeSpan timespan, string fmt, params object[] vars)
|
||||
{
|
||||
TraceApi(componentName, method, timespan, string.Format(fmt, vars));
|
||||
}
|
||||
public void TraceApi(string componentName, string method, TimeSpan timespan, string properties)
|
||||
{
|
||||
string message = String.Concat("Component:", componentName, ";Method:", method, ";Timespan:", timespan.ToString(), ";Properties:", properties);
|
||||
Trace.TraceInformation(message);
|
||||
}
|
||||
|
||||
private static string FormatExceptionMessage(Exception exception, string fmt, object[] vars)
|
||||
{
|
||||
// Simple exception formatting: for a more comprehensive version see
|
||||
// http://code.msdn.microsoft.com/windowsazure/Fix-It-app-for-Building-cdd80df4
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(string.Format(fmt, vars));
|
||||
sb.Append(" Exception: ");
|
||||
sb.Append(exception.ToString());
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
ContosoUniversity.Logging/Properties/AssemblyInfo.cs
Normal file
36
ContosoUniversity.Logging/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 組件的一般資訊是由下列的屬性集控制。
|
||||
// 變更這些屬性的值即可修改組件的相關
|
||||
// 資訊。
|
||||
[assembly: AssemblyTitle("ContosoUniversity.Logging")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ContosoUniversity.Logging")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 將 ComVisible 設為 false 可對 COM 元件隱藏
|
||||
// 組件中的類型。若必須從 COM 存取此組件中的類型,
|
||||
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
|
||||
[assembly: Guid("ae7e2487-4f2f-49f8-b9c2-96b11bb8ea76")]
|
||||
|
||||
// 組件的版本資訊由下列四個值所組成:
|
||||
//
|
||||
// 主要版本
|
||||
// 次要版本
|
||||
// 組建編號
|
||||
// 修訂編號
|
||||
//
|
||||
// 您可以指定所有的值,或將組建編號或修訂編號設為預設值
|
||||
//方法是使用 '*',如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
13
ContosoUniversity.Models/App.config
Normal file
13
ContosoUniversity.Models/App.config
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
|
||||
</configSections>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
|
||||
</providers>
|
||||
</entityFramework>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
|
||||
66
ContosoUniversity.Models/ContosoUniversity.Models.csproj
Normal file
66
ContosoUniversity.Models/ContosoUniversity.Models.csproj
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2627D24E-56A3-427F-BE01-A9F7AA084B1F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ContosoUniversity.Models</RootNamespace>
|
||||
<AssemblyName>ContosoUniversity.Models</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Course.cs" />
|
||||
<Compile Include="Department.cs" />
|
||||
<Compile Include="Enrollment.cs" />
|
||||
<Compile Include="Instructor.cs" />
|
||||
<Compile Include="OfficeAssignment.cs" />
|
||||
<Compile Include="Person.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Student.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
25
ContosoUniversity.Models/Course.cs
Normal file
25
ContosoUniversity.Models/Course.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ContosoUniversity.Models
|
||||
{
|
||||
public class Course
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Display(Name = "Number")]
|
||||
public int CourseID { get; set; }
|
||||
|
||||
[StringLength(50, MinimumLength = 3)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[Range(0, 5)]
|
||||
public int Credits { get; set; }
|
||||
|
||||
public int DepartmentID { get; set; }
|
||||
|
||||
public virtual Department Department { get; set; }
|
||||
public virtual ICollection<Enrollment> Enrollments { get; set; }
|
||||
public virtual ICollection<Instructor> Instructors { get; set; }
|
||||
}
|
||||
}
|
||||
32
ContosoUniversity.Models/Department.cs
Normal file
32
ContosoUniversity.Models/Department.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ContosoUniversity.Models
|
||||
{
|
||||
public class Department
|
||||
{
|
||||
public int DepartmentID { get; set; }
|
||||
|
||||
[StringLength(50, MinimumLength = 3)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataType(DataType.Currency)]
|
||||
[Column(TypeName = "money")]
|
||||
public decimal Budget { get; set; }
|
||||
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
|
||||
[Display(Name = "Start Date")]
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
public int? InstructorID { get; set; }
|
||||
|
||||
[Timestamp]
|
||||
public byte[] RowVersion { get; set; }
|
||||
|
||||
public virtual Instructor Administrator { get; set; }
|
||||
public virtual ICollection<Course> Courses { get; set; }
|
||||
}
|
||||
}
|
||||
22
ContosoUniversity.Models/Enrollment.cs
Normal file
22
ContosoUniversity.Models/Enrollment.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ContosoUniversity.Models
|
||||
{
|
||||
public enum Grade
|
||||
{
|
||||
A, B, C, D, F
|
||||
}
|
||||
|
||||
public class Enrollment
|
||||
{
|
||||
public int EnrollmentID { get; set; }
|
||||
public int CourseID { get; set; }
|
||||
public int StudentID { get; set; }
|
||||
[DisplayFormat(NullDisplayText = "No grade")]
|
||||
public Grade? Grade { get; set; }
|
||||
|
||||
public virtual Course Course { get; set; }
|
||||
public virtual Student Student { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
18
ContosoUniversity.Models/Instructor.cs
Normal file
18
ContosoUniversity.Models/Instructor.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ContosoUniversity.Models
|
||||
{
|
||||
public class Instructor : Person
|
||||
{
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
|
||||
[Display(Name = "Hire Date")]
|
||||
public DateTime HireDate { get; set; }
|
||||
|
||||
public virtual ICollection<Course> Courses { get; set; }
|
||||
public virtual OfficeAssignment OfficeAssignment { get; set; }
|
||||
}
|
||||
}
|
||||
17
ContosoUniversity.Models/OfficeAssignment.cs
Normal file
17
ContosoUniversity.Models/OfficeAssignment.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ContosoUniversity.Models
|
||||
{
|
||||
public class OfficeAssignment
|
||||
{
|
||||
[Key]
|
||||
[ForeignKey("Instructor")]
|
||||
public int InstructorID { get; set; }
|
||||
[StringLength(50)]
|
||||
[Display(Name = "Office Location")]
|
||||
public string Location { get; set; }
|
||||
|
||||
public virtual Instructor Instructor { get; set; }
|
||||
}
|
||||
}
|
||||
31
ContosoUniversity.Models/Person.cs
Normal file
31
ContosoUniversity.Models/Person.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ContosoUniversity.Models
|
||||
{
|
||||
public abstract class Person
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
[Required]
|
||||
[StringLength(50)]
|
||||
[Display(Name = "Last Name")]
|
||||
public string LastName { get; set; }
|
||||
|
||||
[RegularExpression("\\D+", ErrorMessage = "Blah!")]
|
||||
[Required]
|
||||
[StringLength(50, ErrorMessage = "First name cannot be longer than 50 characters.")]
|
||||
[Column("FirstName")]
|
||||
[Display(Name = "First Name")]
|
||||
public string FirstMidName { get; set; }
|
||||
|
||||
[Display(Name = "Full Name")]
|
||||
public string FullName
|
||||
{
|
||||
get
|
||||
{
|
||||
return LastName + ", " + FirstMidName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
ContosoUniversity.Models/Properties/AssemblyInfo.cs
Normal file
36
ContosoUniversity.Models/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 組件的一般資訊是由下列的屬性集控制。
|
||||
// 變更這些屬性的值即可修改組件的相關
|
||||
// 資訊。
|
||||
[assembly: AssemblyTitle("ContosoUniversity.Models")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ContosoUniversity.Models")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 將 ComVisible 設為 false 可對 COM 元件隱藏
|
||||
// 組件中的類型。若必須從 COM 存取此組件中的類型,
|
||||
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
|
||||
[assembly: Guid("2627d24e-56a3-427f-be01-a9f7aa084b1f")]
|
||||
|
||||
// 組件的版本資訊由下列四個值所組成:
|
||||
//
|
||||
// 主要版本
|
||||
// 次要版本
|
||||
// 組建編號
|
||||
// 修訂編號
|
||||
//
|
||||
// 您可以指定所有的值,或將組建編號或修訂編號設為預設值
|
||||
//方法是使用 '*',如下所示:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
17
ContosoUniversity.Models/Student.cs
Normal file
17
ContosoUniversity.Models/Student.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace ContosoUniversity.Models
|
||||
{
|
||||
public class Student : Person
|
||||
{
|
||||
[DataType(DataType.Date)]
|
||||
[DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
|
||||
[Display(Name = "Enrollment Date")]
|
||||
public DateTime EnrollmentDate { get; set; }
|
||||
|
||||
public virtual ICollection<Enrollment> Enrollments { get; set; }
|
||||
}
|
||||
}
|
||||
4
ContosoUniversity.Models/packages.config
Normal file
4
ContosoUniversity.Models/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.1.1" targetFramework="net451" />
|
||||
</packages>
|
||||
45
ContosoUniversity.sln
Normal file
45
ContosoUniversity.sln
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.1082
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContosoUniversity", "ContosoUniversity\ContosoUniversity.csproj", "{264E21D6-4024-4A53-B1BE-1CD42F3348FE}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{BA324694-07F7-4D59-868A-AA10BAC225CA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContosoUniversity.DAL", "ContosoUniversity.DAL\ContosoUniversity.DAL.csproj", "{4B2BE745-7993-451E-BA68-7B6C1D536802}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContosoUniversity.Logging", "ContosoUniversity.Logging\ContosoUniversity.Logging.csproj", "{AE7E2487-4F2F-49F8-B9C2-96B11BB8EA76}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ContosoUniversity.Models", "ContosoUniversity.Models\ContosoUniversity.Models.csproj", "{2627D24E-56A3-427F-BE01-A9F7AA084B1F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{264E21D6-4024-4A53-B1BE-1CD42F3348FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{264E21D6-4024-4A53-B1BE-1CD42F3348FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{264E21D6-4024-4A53-B1BE-1CD42F3348FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{264E21D6-4024-4A53-B1BE-1CD42F3348FE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4B2BE745-7993-451E-BA68-7B6C1D536802}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4B2BE745-7993-451E-BA68-7B6C1D536802}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4B2BE745-7993-451E-BA68-7B6C1D536802}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4B2BE745-7993-451E-BA68-7B6C1D536802}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AE7E2487-4F2F-49F8-B9C2-96B11BB8EA76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AE7E2487-4F2F-49F8-B9C2-96B11BB8EA76}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AE7E2487-4F2F-49F8-B9C2-96B11BB8EA76}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AE7E2487-4F2F-49F8-B9C2-96B11BB8EA76}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2627D24E-56A3-427F-BE01-A9F7AA084B1F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2627D24E-56A3-427F-BE01-A9F7AA084B1F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2627D24E-56A3-427F-BE01-A9F7AA084B1F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2627D24E-56A3-427F-BE01-A9F7AA084B1F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0930BFE5-F83C-4877-962D-F36B081B6A4F}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
35
ContosoUniversity/App_Start/BundleConfig.cs
Normal file
35
ContosoUniversity/App_Start/BundleConfig.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Web;
|
||||
using System.Web.Optimization;
|
||||
|
||||
namespace ContosoUniversity
|
||||
{
|
||||
public class BundleConfig
|
||||
{
|
||||
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
|
||||
public static void RegisterBundles(BundleCollection bundles)
|
||||
{
|
||||
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
|
||||
"~/Scripts/jquery-{version}.js"));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
|
||||
"~/Scripts/jquery.validate*"));
|
||||
|
||||
// Use the development version of Modernizr to develop with and learn from. Then, when you're
|
||||
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
|
||||
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
|
||||
"~/Scripts/modernizr-*"));
|
||||
|
||||
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
|
||||
"~/Scripts/bootstrap.js",
|
||||
"~/Scripts/respond.js"));
|
||||
|
||||
bundles.Add(new StyleBundle("~/Content/css").Include(
|
||||
"~/Content/bootstrap.css",
|
||||
"~/Content/site.css"));
|
||||
|
||||
// Set EnableOptimizations to false for debugging. For more information,
|
||||
// visit http://go.microsoft.com/fwlink/?LinkId=301862
|
||||
BundleTable.EnableOptimizations = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
ContosoUniversity/App_Start/FilterConfig.cs
Normal file
13
ContosoUniversity/App_Start/FilterConfig.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace ContosoUniversity
|
||||
{
|
||||
public class FilterConfig
|
||||
{
|
||||
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
|
||||
{
|
||||
filters.Add(new HandleErrorAttribute());
|
||||
}
|
||||
}
|
||||
}
|
||||
23
ContosoUniversity/App_Start/RouteConfig.cs
Normal file
23
ContosoUniversity/App_Start/RouteConfig.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace ContosoUniversity
|
||||
{
|
||||
public class RouteConfig
|
||||
{
|
||||
public static void RegisterRoutes(RouteCollection routes)
|
||||
{
|
||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||
|
||||
routes.MapRoute(
|
||||
name: "Default",
|
||||
url: "{controller}/{action}/{id}",
|
||||
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
166
ContosoUniversity/Content/PagedList.css
Normal file
166
ContosoUniversity/Content/PagedList.css
Normal file
@@ -0,0 +1,166 @@
|
||||
.pagination {
|
||||
display: inline-block;
|
||||
padding-left: 0;
|
||||
margin: 20px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.pagination > li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.pagination > li > a,
|
||||
.pagination > li > span {
|
||||
position: relative;
|
||||
float: left;
|
||||
padding: 6px 12px;
|
||||
margin-left: -1px;
|
||||
line-height: 1.428571429;
|
||||
text-decoration: none;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #dddddd;
|
||||
}
|
||||
|
||||
.pagination > li:first-child > a,
|
||||
.pagination > li:first-child > span {
|
||||
margin-left: 0;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-top-left-radius: 4px;
|
||||
}
|
||||
|
||||
.pagination > li:last-child > a,
|
||||
.pagination > li:last-child > span {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
.pagination > li > a:hover,
|
||||
.pagination > li > span:hover,
|
||||
.pagination > li > a:focus,
|
||||
.pagination > li > span:focus {
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.pagination > .active > a,
|
||||
.pagination > .active > span,
|
||||
.pagination > .active > a:hover,
|
||||
.pagination > .active > span:hover,
|
||||
.pagination > .active > a:focus,
|
||||
.pagination > .active > span:focus {
|
||||
z-index: 2;
|
||||
color: #ffffff;
|
||||
cursor: default;
|
||||
background-color: #428bca;
|
||||
border-color: #428bca;
|
||||
}
|
||||
|
||||
.pagination > .disabled > span,
|
||||
.pagination > .disabled > a,
|
||||
.pagination > .disabled > a:hover,
|
||||
.pagination > .disabled > a:focus {
|
||||
color: #999999;
|
||||
cursor: not-allowed;
|
||||
background-color: #ffffff;
|
||||
border-color: #dddddd;
|
||||
}
|
||||
|
||||
.pagination-lg > li > a,
|
||||
.pagination-lg > li > span {
|
||||
padding: 10px 16px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.pagination-lg > li:first-child > a,
|
||||
.pagination-lg > li:first-child > span {
|
||||
border-bottom-left-radius: 6px;
|
||||
border-top-left-radius: 6px;
|
||||
}
|
||||
|
||||
.pagination-lg > li:last-child > a,
|
||||
.pagination-lg > li:last-child > span {
|
||||
border-top-right-radius: 6px;
|
||||
border-bottom-right-radius: 6px;
|
||||
}
|
||||
|
||||
.pagination-sm > li > a,
|
||||
.pagination-sm > li > span {
|
||||
padding: 5px 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pagination-sm > li:first-child > a,
|
||||
.pagination-sm > li:first-child > span {
|
||||
border-bottom-left-radius: 3px;
|
||||
border-top-left-radius: 3px;
|
||||
}
|
||||
|
||||
.pagination-sm > li:last-child > a,
|
||||
.pagination-sm > li:last-child > span {
|
||||
border-top-right-radius: 3px;
|
||||
border-bottom-right-radius: 3px;
|
||||
}
|
||||
|
||||
.pager {
|
||||
padding-left: 0;
|
||||
margin: 20px 0;
|
||||
text-align: center;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.pager:before,
|
||||
.pager:after {
|
||||
display: table;
|
||||
content: " ";
|
||||
}
|
||||
|
||||
.pager:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.pager:before,
|
||||
.pager:after {
|
||||
display: table;
|
||||
content: " ";
|
||||
}
|
||||
|
||||
.pager:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.pager li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.pager li > a,
|
||||
.pager li > span {
|
||||
display: inline-block;
|
||||
padding: 5px 14px;
|
||||
background-color: #ffffff;
|
||||
border: 1px solid #dddddd;
|
||||
border-radius: 15px;
|
||||
}
|
||||
|
||||
.pager li > a:hover,
|
||||
.pager li > a:focus {
|
||||
text-decoration: none;
|
||||
background-color: #eeeeee;
|
||||
}
|
||||
|
||||
.pager .next > a,
|
||||
.pager .next > span {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.pager .previous > a,
|
||||
.pager .previous > span {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.pager .disabled > a,
|
||||
.pager .disabled > a:hover,
|
||||
.pager .disabled > a:focus,
|
||||
.pager .disabled > span {
|
||||
color: #999999;
|
||||
cursor: not-allowed;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
24
ContosoUniversity/Content/Site.css
Normal file
24
ContosoUniversity/Content/Site.css
Normal file
@@ -0,0 +1,24 @@
|
||||
body {
|
||||
padding-top: 50px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
/* Set padding to keep content from hitting the edges */
|
||||
.body-content {
|
||||
padding-left: 15px;
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
/* Override the default bootstrap behavior where horizontal description lists
|
||||
will truncate terms that are too long to fit in the left column
|
||||
*/
|
||||
.dl-horizontal dt {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
/* Set width on the form input elements since they're 100% wide by default */
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
max-width: 280px;
|
||||
}
|
||||
6816
ContosoUniversity/Content/bootstrap.css
vendored
Normal file
6816
ContosoUniversity/Content/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
20
ContosoUniversity/Content/bootstrap.min.css
vendored
Normal file
20
ContosoUniversity/Content/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
305
ContosoUniversity/ContosoUniversity.csproj
Normal file
305
ContosoUniversity/ContosoUniversity.csproj
Normal file
@@ -0,0 +1,305 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{264E21D6-4024-4A53-B1BE-1CD42F3348FE}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ContosoUniversity</RootNamespace>
|
||||
<AssemblyName>ContosoUniversity</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<MvcBuildViews>false</MvcBuildViews>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<Use64BitIISExpress />
|
||||
<UseGlobalApplicationHostFile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework">
|
||||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer">
|
||||
<HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="PagedList">
|
||||
<HintPath>..\packages\PagedList.1.17.0.0\lib\net40\PagedList.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PagedList.Mvc">
|
||||
<HintPath>..\packages\PagedList.Mvc.4.5.0.0\lib\net40\PagedList.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Net" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http">
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http.WebRequest">
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.0\lib\net45\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Optimization">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Razor.3.2.0\lib\net45\System.Web.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.0\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WebGrease">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Antlr3.Runtime">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath>..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App_Start\BundleConfig.cs" />
|
||||
<Compile Include="App_Start\FilterConfig.cs" />
|
||||
<Compile Include="App_Start\RouteConfig.cs" />
|
||||
<Compile Include="Controllers\CourseController.cs" />
|
||||
<Compile Include="Controllers\DepartmentController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\InstructorController.cs" />
|
||||
<Compile Include="Controllers\StudentController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
<DependentUpon>Global.asax</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201411021828194_InitialCreate.cs" />
|
||||
<Compile Include="Migrations\201411021828194_InitialCreate.Designer.cs">
|
||||
<DependentUpon>201411021828194_InitialCreate.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201411021834484_MaxLengthOnNames.cs" />
|
||||
<Compile Include="Migrations\201411021834484_MaxLengthOnNames.Designer.cs">
|
||||
<DependentUpon>201411021834484_MaxLengthOnNames.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201411021841373_ComplexDataModel.cs" />
|
||||
<Compile Include="Migrations\201411021841373_ComplexDataModel.Designer.cs">
|
||||
<DependentUpon>201411021841373_ComplexDataModel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201411021957458_DepartmentSP.cs" />
|
||||
<Compile Include="Migrations\201411021957458_DepartmentSP.Designer.cs">
|
||||
<DependentUpon>201411021957458_DepartmentSP.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201411022009135_RowVersion.cs" />
|
||||
<Compile Include="Migrations\201411022009135_RowVersion.Designer.cs">
|
||||
<DependentUpon>201411022009135_RowVersion.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\201411022351064_Inheritance.cs" />
|
||||
<Compile Include="Migrations\201411022351064_Inheritance.Designer.cs">
|
||||
<DependentUpon>201411022351064_Inheritance.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Migrations\Configuration.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\AssignedCourseData.cs" />
|
||||
<Compile Include="ViewModels\EnrollmentDateGroup.cs" />
|
||||
<Compile Include="ViewModels\InstructorIndexData.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\bootstrap.css" />
|
||||
<Content Include="Content\bootstrap.min.css" />
|
||||
<Content Include="Content\PagedList.css" />
|
||||
<Content Include="favicon.ico" />
|
||||
<Content Include="fonts\glyphicons-halflings-regular.svg" />
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="Content\Site.css" />
|
||||
<Content Include="Scripts\bootstrap.js" />
|
||||
<Content Include="Scripts\bootstrap.min.js" />
|
||||
<None Include="Scripts\jquery-1.10.2.intellisense.js" />
|
||||
<Content Include="Scripts\jquery-1.10.2.js" />
|
||||
<Content Include="Scripts\jquery-1.10.2.min.js" />
|
||||
<None Include="Scripts\jquery.validate-vsdoc.js" />
|
||||
<Content Include="Scripts\jquery.validate.js" />
|
||||
<Content Include="Scripts\jquery.validate.min.js" />
|
||||
<Content Include="Scripts\jquery.validate.unobtrusive.js" />
|
||||
<Content Include="Scripts\jquery.validate.unobtrusive.min.js" />
|
||||
<Content Include="Scripts\modernizr-2.6.2.js" />
|
||||
<Content Include="Scripts\respond.js" />
|
||||
<Content Include="Scripts\respond.min.js" />
|
||||
<Content Include="Scripts\_references.js" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</Content>
|
||||
<Content Include="Web.Release.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</Content>
|
||||
<Content Include="Views\Web.config" />
|
||||
<Content Include="Views\_ViewStart.cshtml" />
|
||||
<Content Include="Views\Shared\Error.cshtml" />
|
||||
<Content Include="Views\Shared\_Layout.cshtml" />
|
||||
<Content Include="Views\Home\About.cshtml" />
|
||||
<Content Include="Views\Home\Contact.cshtml" />
|
||||
<Content Include="Views\Home\Index.cshtml" />
|
||||
<Content Include="Scripts\jquery-1.10.2.min.map" />
|
||||
<Content Include="Views\Student\Create.cshtml" />
|
||||
<Content Include="Views\Student\Delete.cshtml" />
|
||||
<Content Include="Views\Student\Details.cshtml" />
|
||||
<Content Include="Views\Student\Edit.cshtml" />
|
||||
<Content Include="Views\Student\Index.cshtml" />
|
||||
<Content Include="Views\Course\Create.cshtml" />
|
||||
<Content Include="Views\Course\Delete.cshtml" />
|
||||
<Content Include="Views\Course\Details.cshtml" />
|
||||
<Content Include="Views\Course\Edit.cshtml" />
|
||||
<Content Include="Views\Course\Index.cshtml" />
|
||||
<Content Include="Views\Instructor\Create.cshtml" />
|
||||
<Content Include="Views\Instructor\Delete.cshtml" />
|
||||
<Content Include="Views\Instructor\Details.cshtml" />
|
||||
<Content Include="Views\Instructor\Edit.cshtml" />
|
||||
<Content Include="Views\Instructor\Index.cshtml" />
|
||||
<Content Include="Views\Department\Create.cshtml" />
|
||||
<Content Include="Views\Department\Delete.cshtml" />
|
||||
<Content Include="Views\Department\Details.cshtml" />
|
||||
<Content Include="Views\Department\Edit.cshtml" />
|
||||
<Content Include="Views\Department\Index.cshtml" />
|
||||
<Content Include="Views\Course\UpdateCourseCredits.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="fonts\glyphicons-halflings-regular.woff" />
|
||||
<Content Include="fonts\glyphicons-halflings-regular.ttf" />
|
||||
<Content Include="fonts\glyphicons-halflings-regular.eot" />
|
||||
<Content Include="packages.config" />
|
||||
<None Include="Project_Readme.html" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Migrations\201411021828194_InitialCreate.resx">
|
||||
<DependentUpon>201411021828194_InitialCreate.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201411021834484_MaxLengthOnNames.resx">
|
||||
<DependentUpon>201411021834484_MaxLengthOnNames.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201411021841373_ComplexDataModel.resx">
|
||||
<DependentUpon>201411021841373_ComplexDataModel.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201411021957458_DepartmentSP.resx">
|
||||
<DependentUpon>201411021957458_DepartmentSP.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201411022009135_RowVersion.resx">
|
||||
<DependentUpon>201411022009135_RowVersion.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Migrations\201411022351064_Inheritance.resx">
|
||||
<DependentUpon>201411022351064_Inheritance.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ContosoUniversity.DAL\ContosoUniversity.DAL.csproj">
|
||||
<Project>{4b2be745-7993-451e-ba68-7b6c1d536802}</Project>
|
||||
<Name>ContosoUniversity.DAL</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ContosoUniversity.Logging\ContosoUniversity.Logging.csproj">
|
||||
<Project>{ae7e2487-4f2f-49f8-b9c2-96b11bb8ea76}</Project>
|
||||
<Name>ContosoUniversity.Logging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ContosoUniversity.Models\ContosoUniversity.Models.csproj">
|
||||
<Project>{2627d24e-56a3-427f-be01-a9f7aa084b1f}</Project>
|
||||
<Name>ContosoUniversity.Models</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
|
||||
<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
|
||||
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
|
||||
</Target>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>True</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>12810</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:41787/</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target> -->
|
||||
</Project>
|
||||
180
ContosoUniversity/Controllers/CourseController.cs
Normal file
180
ContosoUniversity/Controllers/CourseController.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using ContosoUniversity.DAL;
|
||||
using ContosoUniversity.Models;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
namespace ContosoUniversity.Controllers
|
||||
{
|
||||
public class CourseController : Controller
|
||||
{
|
||||
private SchoolContext db = new SchoolContext();
|
||||
|
||||
// GET: Course
|
||||
public ActionResult Index(int? SelectedDepartment)
|
||||
{
|
||||
var departments = db.Departments.OrderBy(q => q.Name).ToList();
|
||||
ViewBag.SelectedDepartment = new SelectList(departments, "DepartmentID", "Name", SelectedDepartment);
|
||||
int departmentID = SelectedDepartment.GetValueOrDefault();
|
||||
|
||||
IQueryable<Course> courses = db.Courses
|
||||
.Where(c => !SelectedDepartment.HasValue || c.DepartmentID == departmentID)
|
||||
.OrderBy(d => d.CourseID)
|
||||
.Include(d => d.Department);
|
||||
var sql = courses.ToString();
|
||||
return View(courses.ToList());
|
||||
}
|
||||
|
||||
// GET: Course/Details/5
|
||||
public ActionResult Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Course course = db.Courses.Find(id);
|
||||
if (course == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(course);
|
||||
}
|
||||
|
||||
|
||||
public ActionResult Create()
|
||||
{
|
||||
PopulateDepartmentsDropDownList();
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create([Bind(Include = "CourseID,Title,Credits,DepartmentID")]Course course)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Courses.Add(course);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
catch (RetryLimitExceededException /* dex */)
|
||||
{
|
||||
//Log the error (uncomment dex variable name and add a line here to write a log.)
|
||||
ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
|
||||
}
|
||||
PopulateDepartmentsDropDownList(course.DepartmentID);
|
||||
return View(course);
|
||||
}
|
||||
|
||||
public ActionResult Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Course course = db.Courses.Find(id);
|
||||
if (course == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
PopulateDepartmentsDropDownList(course.DepartmentID);
|
||||
return View(course);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult EditPost(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
var courseToUpdate = db.Courses.Find(id);
|
||||
if (TryUpdateModel(courseToUpdate, "",
|
||||
new string[] { "Title", "Credits", "DepartmentID" }))
|
||||
{
|
||||
try
|
||||
{
|
||||
db.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch (RetryLimitExceededException /* dex */)
|
||||
{
|
||||
//Log the error (uncomment dex variable name and add a line here to write a log.
|
||||
ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
|
||||
}
|
||||
}
|
||||
PopulateDepartmentsDropDownList(courseToUpdate.DepartmentID);
|
||||
return View(courseToUpdate);
|
||||
}
|
||||
|
||||
private void PopulateDepartmentsDropDownList(object selectedDepartment = null)
|
||||
{
|
||||
var departmentsQuery = from d in db.Departments
|
||||
orderby d.Name
|
||||
select d;
|
||||
ViewBag.DepartmentID = new SelectList(departmentsQuery, "DepartmentID", "Name", selectedDepartment);
|
||||
}
|
||||
|
||||
|
||||
// GET: Course/Delete/5
|
||||
public ActionResult Delete(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Course course = db.Courses.Find(id);
|
||||
if (course == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(course);
|
||||
}
|
||||
|
||||
// POST: Course/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
Course course = db.Courses.Find(id);
|
||||
db.Courses.Remove(course);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
public ActionResult UpdateCourseCredits()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult UpdateCourseCredits(int? multiplier)
|
||||
{
|
||||
if (multiplier != null)
|
||||
{
|
||||
ViewBag.RowsAffected = db.Database.ExecuteSqlCommand("UPDATE Course SET Credits = Credits * {0}", multiplier);
|
||||
}
|
||||
return View();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
231
ContosoUniversity/Controllers/DepartmentController.cs
Normal file
231
ContosoUniversity/Controllers/DepartmentController.cs
Normal file
@@ -0,0 +1,231 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using ContosoUniversity.DAL;
|
||||
using ContosoUniversity.Models;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
namespace ContosoUniversity.Controllers
|
||||
{
|
||||
public class DepartmentController : Controller
|
||||
{
|
||||
private SchoolContext db = new SchoolContext();
|
||||
|
||||
// GET: Department
|
||||
public async Task<ActionResult> Index()
|
||||
{
|
||||
var departments = db.Departments.Include(d => d.Administrator);
|
||||
return View(await departments.ToListAsync());
|
||||
}
|
||||
|
||||
// GET: Department/Details/5
|
||||
public async Task<ActionResult> Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
// Commenting out original code to show how to use a raw SQL query.
|
||||
//Department department = await db.Departments.FindAsync(id);
|
||||
|
||||
// Create and execute raw SQL query.
|
||||
string query = "SELECT * FROM Department WHERE DepartmentID = @p0";
|
||||
Department department = await db.Departments.SqlQuery(query, id).SingleOrDefaultAsync();
|
||||
|
||||
if (department == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(department);
|
||||
}
|
||||
|
||||
// GET: Department/Create
|
||||
public ActionResult Create()
|
||||
{
|
||||
ViewBag.InstructorID = new SelectList(db.Instructors, "ID", "FullName");
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Department/Create
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<ActionResult> Create([Bind(Include = "DepartmentID,Name,Budget,StartDate,InstructorID")] Department department)
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Departments.Add(department);
|
||||
await db.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
ViewBag.InstructorID = new SelectList(db.Instructors, "ID", "FullName", department.InstructorID);
|
||||
return View(department);
|
||||
}
|
||||
|
||||
// GET: Department/Edit/5
|
||||
public async Task<ActionResult> Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Department department = await db.Departments.FindAsync(id);
|
||||
if (department == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
ViewBag.InstructorID = new SelectList(db.Instructors, "ID", "FullName", department.InstructorID);
|
||||
return View(department);
|
||||
}
|
||||
|
||||
// POST: Department/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<ActionResult> Edit(int? id, byte[] rowVersion)
|
||||
{
|
||||
string[] fieldsToBind = new string[] { "Name", "Budget", "StartDate", "InstructorID", "RowVersion" };
|
||||
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
var departmentToUpdate = await db.Departments.FindAsync(id);
|
||||
if (departmentToUpdate == null)
|
||||
{
|
||||
Department deletedDepartment = new Department();
|
||||
TryUpdateModel(deletedDepartment, fieldsToBind);
|
||||
ModelState.AddModelError(string.Empty,
|
||||
"Unable to save changes. The department was deleted by another user.");
|
||||
ViewBag.InstructorID = new SelectList(db.Instructors, "ID", "FullName", deletedDepartment.InstructorID);
|
||||
return View(deletedDepartment);
|
||||
}
|
||||
|
||||
if (TryUpdateModel(departmentToUpdate, fieldsToBind))
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(departmentToUpdate).OriginalValues["RowVersion"] = rowVersion;
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch (DbUpdateConcurrencyException ex)
|
||||
{
|
||||
var entry = ex.Entries.Single();
|
||||
var clientValues = (Department)entry.Entity;
|
||||
var databaseEntry = entry.GetDatabaseValues();
|
||||
if (databaseEntry == null)
|
||||
{
|
||||
ModelState.AddModelError(string.Empty,
|
||||
"Unable to save changes. The department was deleted by another user.");
|
||||
}
|
||||
else
|
||||
{
|
||||
var databaseValues = (Department)databaseEntry.ToObject();
|
||||
|
||||
if (databaseValues.Name != clientValues.Name)
|
||||
ModelState.AddModelError("Name", "Current value: "
|
||||
+ databaseValues.Name);
|
||||
if (databaseValues.Budget != clientValues.Budget)
|
||||
ModelState.AddModelError("Budget", "Current value: "
|
||||
+ String.Format("{0:c}", databaseValues.Budget));
|
||||
if (databaseValues.StartDate != clientValues.StartDate)
|
||||
ModelState.AddModelError("StartDate", "Current value: "
|
||||
+ String.Format("{0:d}", databaseValues.StartDate));
|
||||
if (databaseValues.InstructorID != clientValues.InstructorID)
|
||||
ModelState.AddModelError("InstructorID", "Current value: "
|
||||
+ db.Instructors.Find(databaseValues.InstructorID).FullName);
|
||||
ModelState.AddModelError(string.Empty, "The record you attempted to edit "
|
||||
+ "was modified by another user after you got the original value. The "
|
||||
+ "edit operation was canceled and the current values in the database "
|
||||
+ "have been displayed. If you still want to edit this record, click "
|
||||
+ "the Save button again. Otherwise click the Back to List hyperlink.");
|
||||
departmentToUpdate.RowVersion = databaseValues.RowVersion;
|
||||
}
|
||||
}
|
||||
catch (RetryLimitExceededException /* dex */)
|
||||
{
|
||||
//Log the error (uncomment dex variable name and add a line here to write a log.
|
||||
ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
|
||||
}
|
||||
}
|
||||
ViewBag.InstructorID = new SelectList(db.Instructors, "ID", "FullName", departmentToUpdate.InstructorID);
|
||||
return View(departmentToUpdate);
|
||||
}
|
||||
|
||||
// GET: Department/Delete/5
|
||||
public async Task<ActionResult> Delete(int? id, bool? concurrencyError)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Department department = await db.Departments.FindAsync(id);
|
||||
if (department == null)
|
||||
{
|
||||
if (concurrencyError.GetValueOrDefault())
|
||||
{
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
return HttpNotFound();
|
||||
}
|
||||
|
||||
if (concurrencyError.GetValueOrDefault())
|
||||
{
|
||||
ViewBag.ConcurrencyErrorMessage = "The record you attempted to delete "
|
||||
+ "was modified by another user after you got the original values. "
|
||||
+ "The delete operation was canceled and the current values in the "
|
||||
+ "database have been displayed. If you still want to delete this "
|
||||
+ "record, click the Delete button again. Otherwise "
|
||||
+ "click the Back to List hyperlink.";
|
||||
}
|
||||
|
||||
return View(department);
|
||||
}
|
||||
|
||||
// POST: Department/Delete/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public async Task<ActionResult> Delete(Department department)
|
||||
{
|
||||
try
|
||||
{
|
||||
db.Entry(department).State = EntityState.Deleted;
|
||||
await db.SaveChangesAsync();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
return RedirectToAction("Delete", new { concurrencyError = true, id = department.DepartmentID });
|
||||
}
|
||||
catch (DataException /* dex */)
|
||||
{
|
||||
//Log the error (uncomment dex variable name after DataException and add a line here to write a log.
|
||||
ModelState.AddModelError(string.Empty, "Unable to delete. Try again, and if the problem persists contact your system administrator.");
|
||||
return View(department);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
54
ContosoUniversity/Controllers/HomeController.cs
Normal file
54
ContosoUniversity/Controllers/HomeController.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using ContosoUniversity.DAL;
|
||||
using ContosoUniversity.ViewModels;
|
||||
|
||||
|
||||
namespace ContosoUniversity.Controllers
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
private SchoolContext db = new SchoolContext();
|
||||
|
||||
public ActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public ActionResult About()
|
||||
{
|
||||
// Commenting out LINQ to show how to do the same thing in SQL.
|
||||
//IQueryable<EnrollmentDateGroup> = from student in db.Students
|
||||
// group student by student.EnrollmentDate into dateGroup
|
||||
// select new EnrollmentDateGroup()
|
||||
// {
|
||||
// EnrollmentDate = dateGroup.Key,
|
||||
// StudentCount = dateGroup.Count()
|
||||
// };
|
||||
|
||||
// SQL version of the above LINQ code.
|
||||
string query = "SELECT EnrollmentDate, COUNT(*) AS StudentCount "
|
||||
+ "FROM Person "
|
||||
+ "WHERE Discriminator = 'Student' "
|
||||
+ "GROUP BY EnrollmentDate";
|
||||
IEnumerable<EnrollmentDateGroup> data = db.Database.SqlQuery<EnrollmentDateGroup>(query);
|
||||
|
||||
return View(data.ToList());
|
||||
}
|
||||
public ActionResult Contact()
|
||||
{
|
||||
ViewBag.Message = "Your contact page.";
|
||||
|
||||
return View();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
db.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
263
ContosoUniversity/Controllers/InstructorController.cs
Normal file
263
ContosoUniversity/Controllers/InstructorController.cs
Normal file
@@ -0,0 +1,263 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using ContosoUniversity.DAL;
|
||||
using ContosoUniversity.Models;
|
||||
using ContosoUniversity.ViewModels;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
namespace ContosoUniversity.Controllers
|
||||
{
|
||||
public class InstructorController : Controller
|
||||
{
|
||||
private SchoolContext db = new SchoolContext();
|
||||
|
||||
// GET: Instructor
|
||||
public ActionResult Index(int? id, int? courseID)
|
||||
{
|
||||
var viewModel = new InstructorIndexData();
|
||||
|
||||
viewModel.Instructors = db.Instructors
|
||||
.Include(i => i.OfficeAssignment)
|
||||
.Include(i => i.Courses.Select(c => c.Department))
|
||||
.OrderBy(i => i.LastName);
|
||||
|
||||
if (id != null)
|
||||
{
|
||||
ViewBag.InstructorID = id.Value;
|
||||
viewModel.Courses = viewModel.Instructors.Where(
|
||||
i => i.ID == id.Value).Single().Courses;
|
||||
}
|
||||
|
||||
if (courseID != null)
|
||||
{
|
||||
ViewBag.CourseID = courseID.Value;
|
||||
// Lazy loading
|
||||
//viewModel.Enrollments = viewModel.Courses.Where(
|
||||
// x => x.CourseID == courseID).Single().Enrollments;
|
||||
// Explicit loading
|
||||
var selectedCourse = viewModel.Courses.Where(x => x.CourseID == courseID).Single();
|
||||
db.Entry(selectedCourse).Collection(x => x.Enrollments).Load();
|
||||
foreach (Enrollment enrollment in selectedCourse.Enrollments)
|
||||
{
|
||||
db.Entry(enrollment).Reference(x => x.Student).Load();
|
||||
}
|
||||
|
||||
viewModel.Enrollments = selectedCourse.Enrollments;
|
||||
}
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
|
||||
// GET: Instructor/Details/5
|
||||
public ActionResult Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Instructor instructor = db.Instructors.Find(id);
|
||||
if (instructor == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(instructor);
|
||||
}
|
||||
|
||||
public ActionResult Create()
|
||||
{
|
||||
var instructor = new Instructor();
|
||||
instructor.Courses = new List<Course>();
|
||||
PopulateAssignedCourseData(instructor);
|
||||
return View();
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create([Bind(Include = "LastName,FirstMidName,HireDate,OfficeAssignment")]Instructor instructor, string[] selectedCourses)
|
||||
{
|
||||
if (selectedCourses != null)
|
||||
{
|
||||
instructor.Courses = new List<Course>();
|
||||
foreach (var course in selectedCourses)
|
||||
{
|
||||
var courseToAdd = db.Courses.Find(int.Parse(course));
|
||||
instructor.Courses.Add(courseToAdd);
|
||||
}
|
||||
}
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Instructors.Add(instructor);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
PopulateAssignedCourseData(instructor);
|
||||
return View(instructor);
|
||||
}
|
||||
|
||||
|
||||
// GET: Instructor/Edit/5
|
||||
public ActionResult Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Instructor instructor = db.Instructors
|
||||
.Include(i => i.OfficeAssignment)
|
||||
.Include(i => i.Courses)
|
||||
.Where(i => i.ID == id)
|
||||
.Single();
|
||||
PopulateAssignedCourseData(instructor);
|
||||
if (instructor == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(instructor);
|
||||
}
|
||||
|
||||
private void PopulateAssignedCourseData(Instructor instructor)
|
||||
{
|
||||
var allCourses = db.Courses;
|
||||
var instructorCourses = new HashSet<int>(instructor.Courses.Select(c => c.CourseID));
|
||||
var viewModel = new List<AssignedCourseData>();
|
||||
foreach (var course in allCourses)
|
||||
{
|
||||
viewModel.Add(new AssignedCourseData
|
||||
{
|
||||
CourseID = course.CourseID,
|
||||
Title = course.Title,
|
||||
Assigned = instructorCourses.Contains(course.CourseID)
|
||||
});
|
||||
}
|
||||
ViewBag.Courses = viewModel;
|
||||
}
|
||||
// POST: Instructor/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Edit(int? id, string[] selectedCourses)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
var instructorToUpdate = db.Instructors
|
||||
.Include(i => i.OfficeAssignment)
|
||||
.Include(i => i.Courses)
|
||||
.Where(i => i.ID == id)
|
||||
.Single();
|
||||
|
||||
if (TryUpdateModel(instructorToUpdate, "",
|
||||
new string[] { "LastName", "FirstMidName", "HireDate", "OfficeAssignment" }))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(instructorToUpdate.OfficeAssignment.Location))
|
||||
{
|
||||
instructorToUpdate.OfficeAssignment = null;
|
||||
}
|
||||
|
||||
UpdateInstructorCourses(selectedCourses, instructorToUpdate);
|
||||
|
||||
db.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch (RetryLimitExceededException /* dex */)
|
||||
{
|
||||
//Log the error (uncomment dex variable name and add a line here to write a log.
|
||||
ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
|
||||
}
|
||||
}
|
||||
PopulateAssignedCourseData(instructorToUpdate);
|
||||
return View(instructorToUpdate);
|
||||
}
|
||||
private void UpdateInstructorCourses(string[] selectedCourses, Instructor instructorToUpdate)
|
||||
{
|
||||
if (selectedCourses == null)
|
||||
{
|
||||
instructorToUpdate.Courses = new List<Course>();
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedCoursesHS = new HashSet<string>(selectedCourses);
|
||||
var instructorCourses = new HashSet<int>
|
||||
(instructorToUpdate.Courses.Select(c => c.CourseID));
|
||||
foreach (var course in db.Courses)
|
||||
{
|
||||
if (selectedCoursesHS.Contains(course.CourseID.ToString()))
|
||||
{
|
||||
if (!instructorCourses.Contains(course.CourseID))
|
||||
{
|
||||
instructorToUpdate.Courses.Add(course);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (instructorCourses.Contains(course.CourseID))
|
||||
{
|
||||
instructorToUpdate.Courses.Remove(course);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// GET: Instructor/Delete/5
|
||||
public ActionResult Delete(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Instructor instructor = db.Instructors.Find(id);
|
||||
if (instructor == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(instructor);
|
||||
}
|
||||
|
||||
// POST: Instructor/Delete/5
|
||||
[HttpPost, ActionName("Delete")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult DeleteConfirmed(int id)
|
||||
{
|
||||
Instructor instructor = db.Instructors
|
||||
.Include(i => i.OfficeAssignment)
|
||||
.Where(i => i.ID == id)
|
||||
.Single();
|
||||
|
||||
instructor.OfficeAssignment = null;
|
||||
db.Instructors.Remove(instructor);
|
||||
|
||||
var department = db.Departments
|
||||
.Where(d => d.InstructorID == id)
|
||||
.SingleOrDefault();
|
||||
if (department != null)
|
||||
{
|
||||
department.InstructorID = null;
|
||||
}
|
||||
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
204
ContosoUniversity/Controllers/StudentController.cs
Normal file
204
ContosoUniversity/Controllers/StudentController.cs
Normal file
@@ -0,0 +1,204 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Entity;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using ContosoUniversity.DAL;
|
||||
using ContosoUniversity.Models;
|
||||
using PagedList;
|
||||
using System.Data.Entity.Infrastructure;
|
||||
|
||||
namespace ContosoUniversity.Controllers
|
||||
{
|
||||
public class StudentController : Controller
|
||||
{
|
||||
private SchoolContext db = new SchoolContext();
|
||||
|
||||
// GET: Student
|
||||
public ViewResult Index(string sortOrder, string currentFilter, string searchString, int? page)
|
||||
{
|
||||
ViewBag.CurrentSort = sortOrder;
|
||||
ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
|
||||
ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date";
|
||||
|
||||
if (searchString != null)
|
||||
{
|
||||
page = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
searchString = currentFilter;
|
||||
}
|
||||
|
||||
ViewBag.CurrentFilter = searchString;
|
||||
|
||||
var students = from s in db.Students
|
||||
select s;
|
||||
if (!String.IsNullOrEmpty(searchString))
|
||||
{
|
||||
students = students.Where(s => s.LastName.Contains(searchString)
|
||||
|| s.FirstMidName.Contains(searchString));
|
||||
}
|
||||
switch (sortOrder)
|
||||
{
|
||||
case "name_desc":
|
||||
students = students.OrderByDescending(s => s.LastName);
|
||||
break;
|
||||
case "Date":
|
||||
students = students.OrderBy(s => s.EnrollmentDate);
|
||||
break;
|
||||
case "date_desc":
|
||||
students = students.OrderByDescending(s => s.EnrollmentDate);
|
||||
break;
|
||||
default: // Name ascending
|
||||
students = students.OrderBy(s => s.LastName);
|
||||
break;
|
||||
}
|
||||
|
||||
int pageSize = 3;
|
||||
int pageNumber = (page ?? 1);
|
||||
return View(students.ToPagedList(pageNumber, pageSize));
|
||||
}
|
||||
|
||||
|
||||
// GET: Student/Details/5
|
||||
public ActionResult Details(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Student student = db.Students.Find(id);
|
||||
if (student == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(student);
|
||||
}
|
||||
|
||||
// GET: Student/Create
|
||||
public ActionResult Create()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
// POST: Student/Create
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create([Bind(Include = "LastName, FirstMidName, EnrollmentDate")]Student student)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (ModelState.IsValid)
|
||||
{
|
||||
db.Students.Add(student);
|
||||
db.SaveChanges();
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
}
|
||||
catch (RetryLimitExceededException /* dex */)
|
||||
{
|
||||
//Log the error (uncomment dex variable name and add a line here to write a log.
|
||||
ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
|
||||
}
|
||||
return View(student);
|
||||
}
|
||||
|
||||
|
||||
// GET: Student/Edit/5
|
||||
public ActionResult Edit(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
Student student = db.Students.Find(id);
|
||||
if (student == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(student);
|
||||
}
|
||||
|
||||
// POST: Student/Edit/5
|
||||
// To protect from overposting attacks, please enable the specific properties you want to bind to, for
|
||||
// more details see http://go.microsoft.com/fwlink/?LinkId=317598.
|
||||
[HttpPost, ActionName("Edit")]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult EditPost(int? id)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
var studentToUpdate = db.Students.Find(id);
|
||||
if (TryUpdateModel(studentToUpdate, "",
|
||||
new string[] { "LastName", "FirstMidName", "EnrollmentDate" }))
|
||||
{
|
||||
try
|
||||
{
|
||||
db.SaveChanges();
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
catch (RetryLimitExceededException /* dex */)
|
||||
{
|
||||
//Log the error (uncomment dex variable name and add a line here to write a log.
|
||||
ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
|
||||
}
|
||||
}
|
||||
return View(studentToUpdate);
|
||||
}
|
||||
|
||||
// GET: Student/Delete/5
|
||||
public ActionResult Delete(int? id, bool? saveChangesError = false)
|
||||
{
|
||||
if (id == null)
|
||||
{
|
||||
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
|
||||
}
|
||||
if (saveChangesError.GetValueOrDefault())
|
||||
{
|
||||
ViewBag.ErrorMessage = "Delete failed. Try again, and if the problem persists see your system administrator.";
|
||||
}
|
||||
Student student = db.Students.Find(id);
|
||||
if (student == null)
|
||||
{
|
||||
return HttpNotFound();
|
||||
}
|
||||
return View(student);
|
||||
}
|
||||
|
||||
// POST: Student/Delete/5
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Delete(int id)
|
||||
{
|
||||
try
|
||||
{
|
||||
Student student = db.Students.Find(id);
|
||||
db.Students.Remove(student);
|
||||
db.SaveChanges();
|
||||
}
|
||||
catch (RetryLimitExceededException/* dex */)
|
||||
{
|
||||
//Log the error (uncomment dex variable name and add a line here to write a log.
|
||||
return RedirectToAction("Delete", new { id = id, saveChangesError = true });
|
||||
}
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
1
ContosoUniversity/Global.asax
Normal file
1
ContosoUniversity/Global.asax
Normal file
@@ -0,0 +1 @@
|
||||
<%@ Application Codebehind="Global.asax.cs" Inherits="ContosoUniversity.MvcApplication" Language="C#" %>
|
||||
25
ContosoUniversity/Global.asax.cs
Normal file
25
ContosoUniversity/Global.asax.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Optimization;
|
||||
using System.Web.Routing;
|
||||
using ContosoUniversity.DAL;
|
||||
using System.Data.Entity.Infrastructure.Interception;
|
||||
|
||||
namespace ContosoUniversity
|
||||
{
|
||||
public class MvcApplication : System.Web.HttpApplication
|
||||
{
|
||||
protected void Application_Start()
|
||||
{
|
||||
AreaRegistration.RegisterAllAreas();
|
||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||
RouteConfig.RegisterRoutes(RouteTable.Routes);
|
||||
BundleConfig.RegisterBundles(BundleTable.Bundles);
|
||||
DbInterception.Add(new SchoolInterceptorTransientErrors());
|
||||
DbInterception.Add(new SchoolInterceptorLogging());
|
||||
}
|
||||
}
|
||||
}
|
||||
29
ContosoUniversity/Migrations/201411021828194_InitialCreate.Designer.cs
generated
Normal file
29
ContosoUniversity/Migrations/201411021828194_InitialCreate.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")]
|
||||
public sealed partial class InitialCreate : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(InitialCreate));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201411021828194_InitialCreate"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class InitialCreate : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.Course",
|
||||
c => new
|
||||
{
|
||||
CourseID = c.Int(nullable: false),
|
||||
Title = c.String(),
|
||||
Credits = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.CourseID);
|
||||
|
||||
CreateTable(
|
||||
"dbo.Enrollment",
|
||||
c => new
|
||||
{
|
||||
EnrollmentID = c.Int(nullable: false, identity: true),
|
||||
CourseID = c.Int(nullable: false),
|
||||
StudentID = c.Int(nullable: false),
|
||||
Grade = c.Int(),
|
||||
})
|
||||
.PrimaryKey(t => t.EnrollmentID)
|
||||
.ForeignKey("dbo.Course", t => t.CourseID, cascadeDelete: true)
|
||||
.ForeignKey("dbo.Student", t => t.StudentID, cascadeDelete: true)
|
||||
.Index(t => t.CourseID)
|
||||
.Index(t => t.StudentID);
|
||||
|
||||
CreateTable(
|
||||
"dbo.Student",
|
||||
c => new
|
||||
{
|
||||
ID = c.Int(nullable: false, identity: true),
|
||||
LastName = c.String(),
|
||||
FirstMidName = c.String(),
|
||||
EnrollmentDate = c.DateTime(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.ID);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.Enrollment", "StudentID", "dbo.Student");
|
||||
DropForeignKey("dbo.Enrollment", "CourseID", "dbo.Course");
|
||||
DropIndex("dbo.Enrollment", new[] { "StudentID" });
|
||||
DropIndex("dbo.Enrollment", new[] { "CourseID" });
|
||||
DropTable("dbo.Student");
|
||||
DropTable("dbo.Enrollment");
|
||||
DropTable("dbo.Course");
|
||||
}
|
||||
}
|
||||
}
|
||||
126
ContosoUniversity/Migrations/201411021828194_InitialCreate.resx
Normal file
126
ContosoUniversity/Migrations/201411021828194_InitialCreate.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Target" xml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ipTIT+1ZWAXclTJzNjST6uFZlEqom1Y5iAIbk/IeSjcJbEFvraB8/gbkeRS/dJ7BGfGbiIRRAKXDN4jLXzkIktO0/wx/V20eXQTxJ9xfIsloJmu3GHdsI+RSx1l97Rih1WjQtayZI8qYynkXnW1UZrKn4vWKUrcp0rwHXgBRWX8hi3IM+xi2z2HK1gRe5NSBvVK2gNRdPvowiWrkHg80ZGNxz8Rw463fv8fAnAS7mMuAAA=</value>
|
||||
</data>
|
||||
<data name="DefaultSchema" xml:space="preserve">
|
||||
<value>dbo</value>
|
||||
</data>
|
||||
</root>
|
||||
29
ContosoUniversity/Migrations/201411021834484_MaxLengthOnNames.Designer.cs
generated
Normal file
29
ContosoUniversity/Migrations/201411021834484_MaxLengthOnNames.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")]
|
||||
public sealed partial class MaxLengthOnNames : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(MaxLengthOnNames));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201411021834484_MaxLengthOnNames"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class MaxLengthOnNames : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AlterColumn("dbo.Student", "LastName", c => c.String(maxLength: 50));
|
||||
AlterColumn("dbo.Student", "FirstMidName", c => c.String(maxLength: 50));
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
AlterColumn("dbo.Student", "FirstMidName", c => c.String());
|
||||
AlterColumn("dbo.Student", "LastName", c => c.String());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Target" xml:space="preserve">
|
||||
<value>H4sIAAAAAAAEAN1azW7jNhC+F+g7CDq1RdZykhZoA3sXWSdZGI2TIE4WvQWMNHaEUpQqUoGNok/WQx+pr9ChLFES9W8nTlDsYR1pOBzOfDNDftS/f/8z+rTyqPEMIXd9NjYPB0PTAGb7jsuWYzMSiw8/m58+fvvN6NzxVsbXVO5YyuFIxsfmkxDBiWVx+wk8wgeea4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bk2fYxrZ7DpewJPY6pRHqlbQHouj20ZlLliHxeKIjG49/IoYdb/XxP3JaxXZ1LgAA</value>
|
||||
</data>
|
||||
<data name="DefaultSchema" xml:space="preserve">
|
||||
<value>dbo</value>
|
||||
</data>
|
||||
</root>
|
||||
29
ContosoUniversity/Migrations/201411021841373_ComplexDataModel.Designer.cs
generated
Normal file
29
ContosoUniversity/Migrations/201411021841373_ComplexDataModel.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")]
|
||||
public sealed partial class ComplexDataModel : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(ComplexDataModel));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201411021841373_ComplexDataModel"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class ComplexDataModel : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
RenameColumn(table: "dbo.Student", name: "FirstMidName", newName: "FirstName");
|
||||
CreateTable(
|
||||
"dbo.Department",
|
||||
c => new
|
||||
{
|
||||
DepartmentID = c.Int(nullable: false, identity: true),
|
||||
Name = c.String(maxLength: 50),
|
||||
Budget = c.Decimal(nullable: false, storeType: "money"),
|
||||
StartDate = c.DateTime(nullable: false),
|
||||
InstructorID = c.Int(),
|
||||
})
|
||||
.PrimaryKey(t => t.DepartmentID)
|
||||
.ForeignKey("dbo.Instructor", t => t.InstructorID)
|
||||
.Index(t => t.InstructorID);
|
||||
|
||||
CreateTable(
|
||||
"dbo.Instructor",
|
||||
c => new
|
||||
{
|
||||
ID = c.Int(nullable: false, identity: true),
|
||||
LastName = c.String(nullable: false, maxLength: 50),
|
||||
FirstName = c.String(nullable: false, maxLength: 50),
|
||||
HireDate = c.DateTime(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.ID);
|
||||
|
||||
CreateTable(
|
||||
"dbo.OfficeAssignment",
|
||||
c => new
|
||||
{
|
||||
InstructorID = c.Int(nullable: false),
|
||||
Location = c.String(maxLength: 50),
|
||||
})
|
||||
.PrimaryKey(t => t.InstructorID)
|
||||
.ForeignKey("dbo.Instructor", t => t.InstructorID)
|
||||
.Index(t => t.InstructorID);
|
||||
|
||||
CreateTable(
|
||||
"dbo.CourseInstructor",
|
||||
c => new
|
||||
{
|
||||
CourseID = c.Int(nullable: false),
|
||||
InstructorID = c.Int(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => new { t.CourseID, t.InstructorID })
|
||||
.ForeignKey("dbo.Course", t => t.CourseID, cascadeDelete: true)
|
||||
.ForeignKey("dbo.Instructor", t => t.InstructorID, cascadeDelete: true)
|
||||
.Index(t => t.CourseID)
|
||||
.Index(t => t.InstructorID);
|
||||
|
||||
// Create a department for course to point to.
|
||||
Sql("INSERT INTO dbo.Department (Name, Budget, StartDate) VALUES ('Temp', 0.00, GETDATE())");
|
||||
// default value for FK points to department created above.
|
||||
AddColumn("dbo.Course", "DepartmentID", c => c.Int(nullable: false, defaultValue: 1));
|
||||
//AddColumn("dbo.Course", "DepartmentID", c => c.Int(nullable: false));
|
||||
|
||||
AlterColumn("dbo.Course", "Title", c => c.String(maxLength: 50));
|
||||
AlterColumn("dbo.Student", "LastName", c => c.String(nullable: false, maxLength: 50));
|
||||
AlterColumn("dbo.Student", "FirstName", c => c.String(nullable: false, maxLength: 50));
|
||||
CreateIndex("dbo.Course", "DepartmentID");
|
||||
AddForeignKey("dbo.Course", "DepartmentID", "dbo.Department", "DepartmentID", cascadeDelete: true);
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropForeignKey("dbo.CourseInstructor", "InstructorID", "dbo.Instructor");
|
||||
DropForeignKey("dbo.CourseInstructor", "CourseID", "dbo.Course");
|
||||
DropForeignKey("dbo.Course", "DepartmentID", "dbo.Department");
|
||||
DropForeignKey("dbo.Department", "InstructorID", "dbo.Instructor");
|
||||
DropForeignKey("dbo.OfficeAssignment", "InstructorID", "dbo.Instructor");
|
||||
DropIndex("dbo.CourseInstructor", new[] { "InstructorID" });
|
||||
DropIndex("dbo.CourseInstructor", new[] { "CourseID" });
|
||||
DropIndex("dbo.OfficeAssignment", new[] { "InstructorID" });
|
||||
DropIndex("dbo.Department", new[] { "InstructorID" });
|
||||
DropIndex("dbo.Course", new[] { "DepartmentID" });
|
||||
AlterColumn("dbo.Student", "FirstName", c => c.String(maxLength: 50));
|
||||
AlterColumn("dbo.Student", "LastName", c => c.String(maxLength: 50));
|
||||
AlterColumn("dbo.Course", "Title", c => c.String());
|
||||
DropColumn("dbo.Course", "DepartmentID");
|
||||
DropTable("dbo.CourseInstructor");
|
||||
DropTable("dbo.OfficeAssignment");
|
||||
DropTable("dbo.Instructor");
|
||||
DropTable("dbo.Department");
|
||||
RenameColumn(table: "dbo.Student", name: "FirstName", newName: "FirstMidName");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Target" xml:space="preserve">
|
||||
<value>H4sIAAAAAAAEAO1d227kNhJ9D7D/IOgxmHTbng2QNdoJPG47MWKPB9OeYN8MWmK3hZWojkQZNhb7ZXnIJ+0vLKXWhXeRlPri7GAAT1sii8Wqw2IVWdX+7x9/zn56SWLvGWZ5lKIz/3hy5HsQBWkYodWZX+Dldz/4P/34t29ml2Hy4v3WtHtftiM9UX7mP2G8Pp1O8+AJJiCfJFGQpXm6xJMgTaYgTKcnR0f/mB4fTyEh4RNanjf7XCAcJbD6hfx6kaIArnEB4ts0hHFePydvFhVV7yNIYL4GATzzSVtM6H9BUcU1fp3Mz2987zyOAGFmAeOl7wGEUgwwYfX0Sw4XOEvRarEmD0B8/7qGpN0SxDmsp3DaNTedzdFJOZtp17EhFRQ5ThNLgsfva/FM+e5OQvZb8REBXhJB49dy1pUQS/kVWTl1fqjTizgrm8kkvNHKZNP1nSc0eNcigwCo/EfaFDEuMniGYIEzEL/zPhWPcRT8Cl/v039BdIaKOKYZJaySd8wD8uhTlq5hhl8/wyXD/vXc96Zs7ynfve0s9NxM8xrh9ye+95EwAh5j2GKCEskCpxn8GSKYAQzDTwBjmBGVfkwRFMbnRruPcAyboQgCyXryvVvwcgPRCj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DHm7xD/+To+IT72oHD+QqAaZ6HseTYRPweAFZlOy7Bj0r5WibkMoX16BlkwRPIhETgjqhDHb0LW7K630iajn6NQvhy5v+76njqXf/zge77zrvLCNhOvSPvPz1MuBRmO6h7/HroSi692eiWCqCzw0eCBVvxnKQI2rMllDWH5DMeq6zZFGF0XxXCRIm4VPI6AGxY4cNWwMTXOhgAyryUYRuE+XJXQ5S5l2K66Hn02scx4e9UNulkaFzqDB3EPX5531aWmtQnMNBp02+QPoVCQNPR246DhmcKCDmvYwBupPHuV1u8K1ssLxkb2yLrQ9dhnvwWzPdel/ke9g6VHsep0qKTxxzro9SJXcMLvJwSbbU3RluvsXqDRS5mFVXWUOkp2aNTRB2Lsd4APLSX6ocODPPqp/2WOzW5eLuvbdptMZMyv+eNVy4Z629L+KHTuHdZEmKhz5HrkP6ilUd7LDPaF4bUt5mj72WW8Dm8miHpBdsB2SEhFBM5Ma4veis2qe/m9BAtk+HV6LA46y+LsN064E742rkbzt1ftzjjc855vcqK+jQ1fZu76jM/fEyJ5jdnDtb1fj3lfrIxnMoBe6oBZeMMqBY0KhaUjTmgpLCnolA2mn3Foa7gUDaCqhpRDjatusQmagBqVLe/OkhxdnxasU2ho7Zm8vBrG4cJQ7QffN3AgdcrGrItdSipngpzewC1iMbMKuMeqqfGTh1WpaGsrHDvE9ZU/JnUEioSCQfrWmXy5SmQWxFDU65oJAZ5vuJoJm1b4rCopBTTFokTSv1NJOIOlxtMS6L8C0kIBoz72ba5Rsu08YU5jpom3H3YLcQgJL7peYajJQgweR1AsqWV36hZf+XgZfIIw2t0V+B1gcmUYfIYM18RWnrTuvGrclGW59nduvqSyzGmQNiMyivVO/ShiOKw5ftKchWnIFG66fU9danLciOFq9eWkvhXflSEavG10cU9TNYxIZbfoQV4hi68fcnhDVyB4LXJPlUT6VcEK/bZPAKrDCR5TaPrT34lGA6Tlx//B+6s+jMabAAA</value>
|
||||
</data>
|
||||
<data name="DefaultSchema" xml:space="preserve">
|
||||
<value>dbo</value>
|
||||
</data>
|
||||
</root>
|
||||
29
ContosoUniversity/Migrations/201411021957458_DepartmentSP.Designer.cs
generated
Normal file
29
ContosoUniversity/Migrations/201411021957458_DepartmentSP.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")]
|
||||
public sealed partial class DepartmentSP : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(DepartmentSP));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201411021957458_DepartmentSP"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
69
ContosoUniversity/Migrations/201411021957458_DepartmentSP.cs
Normal file
69
ContosoUniversity/Migrations/201411021957458_DepartmentSP.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class DepartmentSP : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
CreateStoredProcedure(
|
||||
"dbo.Department_Insert",
|
||||
p => new
|
||||
{
|
||||
Name = p.String(maxLength: 50),
|
||||
Budget = p.Decimal(precision: 19, scale: 4, storeType: "money"),
|
||||
StartDate = p.DateTime(),
|
||||
InstructorID = p.Int(),
|
||||
},
|
||||
body:
|
||||
@"INSERT [dbo].[Department]([Name], [Budget], [StartDate], [InstructorID])
|
||||
VALUES (@Name, @Budget, @StartDate, @InstructorID)
|
||||
|
||||
DECLARE @DepartmentID int
|
||||
SELECT @DepartmentID = [DepartmentID]
|
||||
FROM [dbo].[Department]
|
||||
WHERE @@ROWCOUNT > 0 AND [DepartmentID] = scope_identity()
|
||||
|
||||
SELECT t0.[DepartmentID]
|
||||
FROM [dbo].[Department] AS t0
|
||||
WHERE @@ROWCOUNT > 0 AND t0.[DepartmentID] = @DepartmentID"
|
||||
);
|
||||
|
||||
CreateStoredProcedure(
|
||||
"dbo.Department_Update",
|
||||
p => new
|
||||
{
|
||||
DepartmentID = p.Int(),
|
||||
Name = p.String(maxLength: 50),
|
||||
Budget = p.Decimal(precision: 19, scale: 4, storeType: "money"),
|
||||
StartDate = p.DateTime(),
|
||||
InstructorID = p.Int(),
|
||||
},
|
||||
body:
|
||||
@"UPDATE [dbo].[Department]
|
||||
SET [Name] = @Name, [Budget] = @Budget, [StartDate] = @StartDate, [InstructorID] = @InstructorID
|
||||
WHERE ([DepartmentID] = @DepartmentID)"
|
||||
);
|
||||
|
||||
CreateStoredProcedure(
|
||||
"dbo.Department_Delete",
|
||||
p => new
|
||||
{
|
||||
DepartmentID = p.Int(),
|
||||
},
|
||||
body:
|
||||
@"DELETE [dbo].[Department]
|
||||
WHERE ([DepartmentID] = @DepartmentID)"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropStoredProcedure("dbo.Department_Delete");
|
||||
DropStoredProcedure("dbo.Department_Update");
|
||||
DropStoredProcedure("dbo.Department_Insert");
|
||||
}
|
||||
}
|
||||
}
|
||||
126
ContosoUniversity/Migrations/201411021957458_DepartmentSP.resx
Normal file
126
ContosoUniversity/Migrations/201411021957458_DepartmentSP.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Target" xml:space="preserve">
|
||||
<value>H4sIAAAAAAAEAO1d227kuBF9D5B/EPS4mO22ZxJgY7R34XGPN42Mx4NpzyJvBi3RbSES1ZEox0aQL8tDPim/EFIXindRl754Mlhgx5bIYrHqsFhVIsv//fd/Fr88J7H3BLM8StG5fzo78T2IgjSM0ObcL/DDjz/5v/z8+98tPoTJs/db0+4dbUd6ovzcf8R4ezaf58EjTEA+S6IgS/P0Ac+CNJmDMJ2/PTn50/z0dA4JCZ/Q8rzFlwLhKIHlL+TXyxQFcIsLEF+nIYzz+jl5sy6pep9AAvMtCOC5T9piQv8rikqu8ctsefHR9y7iCBBm1jB+8D2AUIoBJqyefc3hGmcp2qy35AGIb1+2kLR7AHEO6ymctc1dZ3Pyls5m3nZsSAVFjtOkJ8HTd7V45nL3QUL2mfiIAD8QQeMXOutSiFR+RUanLg91dhlntJlOwpVWZlXXN57S4A1DBgEQ/Y+0KWJcZPAcwQJnIH7jfS7u4yj4C3y5Tf8G0Tkq4phnlLBK3gkPyKPPWbqFGX75Ah8E9ldL35uLvedyd9ZZ6VlNc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V772KW92uroalrIa/Ky820pCvUtudFTc0I0xqCJHR0EO3TgjCnY41evQjTmiqkdHUQ/daP2LfthqfuhGMBUE0YPNqi61iRmAFtUdrhSJOjv5rkWfWiPWsiXHX15knDBU+yFf3T3ykiGObGujbK6nwdweQTkQZ2aNySCup8VOHVexD11lj4NP2FJ0w6Wch+F09Whdm0y+/lz4TsTQVAxxEoP+EPdkJm1X4uhRzEQ9y00ic+7Pki6WkG4wjAT9I6UIiu4na7NCD2mTIJA4appIhwSuIQYkhgAXGY4eQIDJ6wCSLY0Wta+rfn9I7mG4QjcF3haYTBkm97FQpZ+mGGzjlxVbRJ4XN9uyzvwUUyBsRjQMukE0wAgZ31ea8wkGEtRNrw/vUF3SjRRuXhgl9Q9tmgjV4mMpl1tIIhNCLL9Ba/AEh/D2NYcfSRwVvDRH8s1EuhUhin2xjMCGxEJ5TaPtT34lGA6T55//Bxb/EcmddwAA</value>
|
||||
</data>
|
||||
<data name="DefaultSchema" xml:space="preserve">
|
||||
<value>dbo</value>
|
||||
</data>
|
||||
</root>
|
||||
29
ContosoUniversity/Migrations/201411022009135_RowVersion.Designer.cs
generated
Normal file
29
ContosoUniversity/Migrations/201411022009135_RowVersion.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")]
|
||||
public sealed partial class RowVersion : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(RowVersion));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201411022009135_RowVersion"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
75
ContosoUniversity/Migrations/201411022009135_RowVersion.cs
Normal file
75
ContosoUniversity/Migrations/201411022009135_RowVersion.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
|
||||
public partial class RowVersion : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
AddColumn("dbo.Department", "RowVersion", c => c.Binary(nullable: false, fixedLength: true, timestamp: true, storeType: "rowversion"));
|
||||
AlterStoredProcedure(
|
||||
"dbo.Department_Insert",
|
||||
p => new
|
||||
{
|
||||
Name = p.String(maxLength: 50),
|
||||
Budget = p.Decimal(precision: 19, scale: 4, storeType: "money"),
|
||||
StartDate = p.DateTime(),
|
||||
InstructorID = p.Int(),
|
||||
},
|
||||
body:
|
||||
@"INSERT [dbo].[Department]([Name], [Budget], [StartDate], [InstructorID])
|
||||
VALUES (@Name, @Budget, @StartDate, @InstructorID)
|
||||
|
||||
DECLARE @DepartmentID int
|
||||
SELECT @DepartmentID = [DepartmentID]
|
||||
FROM [dbo].[Department]
|
||||
WHERE @@ROWCOUNT > 0 AND [DepartmentID] = scope_identity()
|
||||
|
||||
SELECT t0.[DepartmentID], t0.[RowVersion]
|
||||
FROM [dbo].[Department] AS t0
|
||||
WHERE @@ROWCOUNT > 0 AND t0.[DepartmentID] = @DepartmentID"
|
||||
);
|
||||
|
||||
AlterStoredProcedure(
|
||||
"dbo.Department_Update",
|
||||
p => new
|
||||
{
|
||||
DepartmentID = p.Int(),
|
||||
Name = p.String(maxLength: 50),
|
||||
Budget = p.Decimal(precision: 19, scale: 4, storeType: "money"),
|
||||
StartDate = p.DateTime(),
|
||||
InstructorID = p.Int(),
|
||||
RowVersion_Original = p.Binary(maxLength: 8, fixedLength: true, storeType: "rowversion"),
|
||||
},
|
||||
body:
|
||||
@"UPDATE [dbo].[Department]
|
||||
SET [Name] = @Name, [Budget] = @Budget, [StartDate] = @StartDate, [InstructorID] = @InstructorID
|
||||
WHERE (([DepartmentID] = @DepartmentID) AND (([RowVersion] = @RowVersion_Original) OR ([RowVersion] IS NULL AND @RowVersion_Original IS NULL)))
|
||||
|
||||
SELECT t0.[RowVersion]
|
||||
FROM [dbo].[Department] AS t0
|
||||
WHERE @@ROWCOUNT > 0 AND t0.[DepartmentID] = @DepartmentID"
|
||||
);
|
||||
|
||||
AlterStoredProcedure(
|
||||
"dbo.Department_Delete",
|
||||
p => new
|
||||
{
|
||||
DepartmentID = p.Int(),
|
||||
RowVersion_Original = p.Binary(maxLength: 8, fixedLength: true, storeType: "rowversion"),
|
||||
},
|
||||
body:
|
||||
@"DELETE [dbo].[Department]
|
||||
WHERE (([DepartmentID] = @DepartmentID) AND (([RowVersion] = @RowVersion_Original) OR ([RowVersion] IS NULL AND @RowVersion_Original IS NULL)))"
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
DropColumn("dbo.Department", "RowVersion");
|
||||
throw new NotSupportedException("Scaffolding create or alter procedure operations is not supported in down methods.");
|
||||
}
|
||||
}
|
||||
}
|
||||
126
ContosoUniversity/Migrations/201411022009135_RowVersion.resx
Normal file
126
ContosoUniversity/Migrations/201411022009135_RowVersion.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Target" xml:space="preserve">
|
||||
<value>H4sIAAAAAAAEAO1d3W7cuBW+L9B3EHS5yM7YSQukxngXjifeDhrHgcdZ9M6gJXpMVKKmEuXYKPpkvegj9RVK6pf/on5mxt4NFtjYFHl4ePjx8ByS5/h///nv4uenOPIeYZqhBJ/6x7Mj34M4SEKEN6d+Tu5/fO///NMf/7D4GMZP3q91vXesHm2Js1P/gZDtyXyeBQ8wBtksRkGaZMk9mQVJPAdhMn97dPSX+fHxHFISPqXleYvrHBMUw+IX+ut5ggO4JTmILpMQRllVTr+sC6reZxDDbAsCeOrTuoTS/4pRwTV5ni3PPvneWYQAZWYNo3vfAxgnBBDK6snXDK5JmuDNeksLQHTzvIW03j2IMlgN4aSt7jqao7dsNPO2YU0qyDOSxD0JHr+rxDOXmw8Sst+IjwrwIxU0eWajLoTI5JenbOhyVyfnUcqq6SRczsqsbPrGUyq8aZBBAcT+o3XyiOQpPMUwJymI3nhf8rsIBX+DzzfJPyA+xXkU8YxSVuk3oYAWfUmTLUzJ8zW8F9hfLX1vLraey82bxkrLcpgrTN699b3PlBFwF8EGE5xI1iRJ4S8QwxQQGH4BhMCUTunnBEOlf6m3G0QiWHdFEUjXk+9dgqdPEG/Iw6n/Z7qALtATDOuCqncqVLr6aBuS5p2dnKcwRCTrGpGdyBJuQUpiiEm3bCRKn8Ej2hSiMtL0vWsYFVWyB7QtF+is/Xxbzgodwk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8tlo+vBlOhGDzbrdKlVzAC0TN3hUuyoo5MjT2yJHEwQ04ccjM9qseO0OeOEoeoPOSR9UgFMnwrHkW3tKQDX0qBuX0CaG2dmjYdVXEuLnnpZSWx0GWsOPmBLMhmXNDWGt+aj59qk8vWv5HcihjoTjpMY9E/aJ1NpuxJHjyQ96sv2xZz/68CLJWQbTEOC/a1gDEXzs6mzwvdJfYAhcVRXkR4xXEICqI8DzlKC7kFA6OcA0i2N/bGGKpv9x/gOhit8lZNtTuiQYXwXCX99gh2B2PovMhGJPC+utsXfT5hiCJRNxNy0K8wclrDh+0LzfsJAgpnp1eMiNpdsI4Wb54aS+vduTYQq8TVHQjeQejqUWHaF1+ARDuHtawY/Ub8seK4DFMxEuidCFPtiicCGekZZRaNtT3+lGA7jp5/+D9qQxlwkewAA</value>
|
||||
</data>
|
||||
<data name="DefaultSchema" xml:space="preserve">
|
||||
<value>dbo</value>
|
||||
</data>
|
||||
</root>
|
||||
29
ContosoUniversity/Migrations/201411022351064_Inheritance.Designer.cs
generated
Normal file
29
ContosoUniversity/Migrations/201411022351064_Inheritance.Designer.cs
generated
Normal file
@@ -0,0 +1,29 @@
|
||||
// <auto-generated />
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Data.Entity.Migrations.Infrastructure;
|
||||
using System.Resources;
|
||||
|
||||
[GeneratedCode("EntityFramework.Migrations", "6.1.1-30610")]
|
||||
public sealed partial class Inheritance : IMigrationMetadata
|
||||
{
|
||||
private readonly ResourceManager Resources = new ResourceManager(typeof(Inheritance));
|
||||
|
||||
string IMigrationMetadata.Id
|
||||
{
|
||||
get { return "201411022351064_Inheritance"; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Source
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
string IMigrationMetadata.Target
|
||||
{
|
||||
get { return Resources.GetString("Target"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
58
ContosoUniversity/Migrations/201411022351064_Inheritance.cs
Normal file
58
ContosoUniversity/Migrations/201411022351064_Inheritance.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using System;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Diagnostics;
|
||||
|
||||
public partial class Inheritance : DbMigration
|
||||
{
|
||||
public override void Up()
|
||||
{
|
||||
// Drop foreign keys and indexes that point to tables we're going to drop.
|
||||
Debug.Print("Start");
|
||||
DropForeignKey("dbo.Enrollment", "StudentID", "dbo.Student");
|
||||
DropIndex("dbo.Enrollment", new[] { "StudentID" });
|
||||
|
||||
RenameTable(name: "dbo.Instructor", newName: "Person");
|
||||
AddColumn("dbo.Person", "EnrollmentDate", c => c.DateTime());
|
||||
AddColumn("dbo.Person", "Discriminator", c => c.String(nullable: false, maxLength: 128, defaultValue: "Instructor"));
|
||||
AlterColumn("dbo.Person", "HireDate", c => c.DateTime());
|
||||
AddColumn("dbo.Person", "OldId", c => c.Int(nullable: true));
|
||||
|
||||
// Copy existing Student data into new Person table.
|
||||
Sql("INSERT INTO dbo.Person (LastName, FirstName, HireDate, EnrollmentDate, Discriminator, OldId) SELECT LastName, FirstName, null AS HireDate, EnrollmentDate, 'Student' AS Discriminator, ID AS OldId FROM dbo.Student");
|
||||
|
||||
// Fix up existing relationships to match new PK's.
|
||||
Sql("UPDATE dbo.Enrollment SET StudentId = (SELECT ID FROM dbo.Person WHERE OldId = Enrollment.StudentId AND Discriminator = 'Student')");
|
||||
|
||||
// Remove temporary key
|
||||
DropColumn("dbo.Person", "OldId");
|
||||
|
||||
DropTable("dbo.Student");
|
||||
|
||||
// Re-create foreign keys and indexes pointing to new table.
|
||||
AddForeignKey("dbo.Enrollment", "StudentID", "dbo.Person", "ID", cascadeDelete: true);
|
||||
CreateIndex("dbo.Enrollment", "StudentID");
|
||||
Debug.Print("end");
|
||||
}
|
||||
|
||||
public override void Down()
|
||||
{
|
||||
CreateTable(
|
||||
"dbo.Student",
|
||||
c => new
|
||||
{
|
||||
ID = c.Int(nullable: false, identity: true),
|
||||
LastName = c.String(nullable: false, maxLength: 50),
|
||||
FirstName = c.String(nullable: false, maxLength: 50),
|
||||
EnrollmentDate = c.DateTime(nullable: false),
|
||||
})
|
||||
.PrimaryKey(t => t.ID);
|
||||
|
||||
AlterColumn("dbo.Person", "HireDate", c => c.DateTime(nullable: false));
|
||||
DropColumn("dbo.Person", "Discriminator");
|
||||
DropColumn("dbo.Person", "EnrollmentDate");
|
||||
RenameTable(name: "dbo.Person", newName: "Instructor");
|
||||
}
|
||||
}
|
||||
}
|
||||
126
ContosoUniversity/Migrations/201411022351064_Inheritance.resx
Normal file
126
ContosoUniversity/Migrations/201411022351064_Inheritance.resx
Normal file
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</res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mEwx7cZWWeEDhlGz6Hw6j/bfbD1nz+qI/I8vV3nfyliiCFQNhGLkG4xixWCmu8rTU6CgQTzkMtkH6ZLtmzC1XtNSf17pSZCpfjq3ZgHSIMMSiy9xQvwCvvw9pjCaxoS+e9V2rqZSLsiRLFPZwisaFCSljSa9vRXiuEgevvhf7i9wmTkeAAA</value>
|
||||
</data>
|
||||
<data name="DefaultSchema" xml:space="preserve">
|
||||
<value>dbo</value>
|
||||
</data>
|
||||
</root>
|
||||
219
ContosoUniversity/Migrations/Configuration.cs
Normal file
219
ContosoUniversity/Migrations/Configuration.cs
Normal file
@@ -0,0 +1,219 @@
|
||||
namespace ContosoUniversity.Migrations
|
||||
{
|
||||
using ContosoUniversity.Models;
|
||||
using ContosoUniversity.DAL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using System.Data.Entity.Migrations;
|
||||
using System.Linq;
|
||||
|
||||
internal sealed class Configuration : DbMigrationsConfiguration<SchoolContext>
|
||||
{
|
||||
public Configuration()
|
||||
{
|
||||
AutomaticMigrationsEnabled = false;
|
||||
}
|
||||
|
||||
protected override void Seed(SchoolContext context)
|
||||
{
|
||||
var students = new List<Student>
|
||||
{
|
||||
new Student { FirstMidName = "Carson", LastName = "Alexander",
|
||||
EnrollmentDate = DateTime.Parse("2010-09-01") },
|
||||
new Student { FirstMidName = "Meredith", LastName = "Alonso",
|
||||
EnrollmentDate = DateTime.Parse("2012-09-01") },
|
||||
new Student { FirstMidName = "Arturo", LastName = "Anand",
|
||||
EnrollmentDate = DateTime.Parse("2013-09-01") },
|
||||
new Student { FirstMidName = "Gytis", LastName = "Barzdukas",
|
||||
EnrollmentDate = DateTime.Parse("2012-09-01") },
|
||||
new Student { FirstMidName = "Yan", LastName = "Li",
|
||||
EnrollmentDate = DateTime.Parse("2012-09-01") },
|
||||
new Student { FirstMidName = "Peggy", LastName = "Justice",
|
||||
EnrollmentDate = DateTime.Parse("2011-09-01") },
|
||||
new Student { FirstMidName = "Laura", LastName = "Norman",
|
||||
EnrollmentDate = DateTime.Parse("2013-09-01") },
|
||||
new Student { FirstMidName = "Nino", LastName = "Olivetto",
|
||||
EnrollmentDate = DateTime.Parse("2005-09-01") }
|
||||
};
|
||||
|
||||
|
||||
students.ForEach(s => context.Students.AddOrUpdate(p => p.LastName, s));
|
||||
context.SaveChanges();
|
||||
|
||||
var instructors = new List<Instructor>
|
||||
{
|
||||
new Instructor { FirstMidName = "Kim", LastName = "Abercrombie",
|
||||
HireDate = DateTime.Parse("1995-03-11") },
|
||||
new Instructor { FirstMidName = "Fadi", LastName = "Fakhouri",
|
||||
HireDate = DateTime.Parse("2002-07-06") },
|
||||
new Instructor { FirstMidName = "Roger", LastName = "Harui",
|
||||
HireDate = DateTime.Parse("1998-07-01") },
|
||||
new Instructor { FirstMidName = "Candace", LastName = "Kapoor",
|
||||
HireDate = DateTime.Parse("2001-01-15") },
|
||||
new Instructor { FirstMidName = "Roger", LastName = "Zheng",
|
||||
HireDate = DateTime.Parse("2004-02-12") }
|
||||
};
|
||||
instructors.ForEach(s => context.Instructors.AddOrUpdate(p => p.LastName, s));
|
||||
context.SaveChanges();
|
||||
|
||||
var departments = new List<Department>
|
||||
{
|
||||
new Department { Name = "English", Budget = 350000,
|
||||
StartDate = DateTime.Parse("2007-09-01"),
|
||||
InstructorID = instructors.Single( i => i.LastName == "Abercrombie").ID },
|
||||
new Department { Name = "Mathematics", Budget = 100000,
|
||||
StartDate = DateTime.Parse("2007-09-01"),
|
||||
InstructorID = instructors.Single( i => i.LastName == "Fakhouri").ID },
|
||||
new Department { Name = "Engineering", Budget = 350000,
|
||||
StartDate = DateTime.Parse("2007-09-01"),
|
||||
InstructorID = instructors.Single( i => i.LastName == "Harui").ID },
|
||||
new Department { Name = "Economics", Budget = 100000,
|
||||
StartDate = DateTime.Parse("2007-09-01"),
|
||||
InstructorID = instructors.Single( i => i.LastName == "Kapoor").ID }
|
||||
};
|
||||
departments.ForEach(s => context.Departments.AddOrUpdate(p => p.Name, s));
|
||||
context.SaveChanges();
|
||||
|
||||
var courses = new List<Course>
|
||||
{
|
||||
new Course {CourseID = 1050, Title = "Chemistry", Credits = 3,
|
||||
DepartmentID = departments.Single( s => s.Name == "Engineering").DepartmentID,
|
||||
Instructors = new List<Instructor>()
|
||||
},
|
||||
new Course {CourseID = 4022, Title = "Microeconomics", Credits = 3,
|
||||
DepartmentID = departments.Single( s => s.Name == "Economics").DepartmentID,
|
||||
Instructors = new List<Instructor>()
|
||||
},
|
||||
new Course {CourseID = 4041, Title = "Macroeconomics", Credits = 3,
|
||||
DepartmentID = departments.Single( s => s.Name == "Economics").DepartmentID,
|
||||
Instructors = new List<Instructor>()
|
||||
},
|
||||
new Course {CourseID = 1045, Title = "Calculus", Credits = 4,
|
||||
DepartmentID = departments.Single( s => s.Name == "Mathematics").DepartmentID,
|
||||
Instructors = new List<Instructor>()
|
||||
},
|
||||
new Course {CourseID = 3141, Title = "Trigonometry", Credits = 4,
|
||||
DepartmentID = departments.Single( s => s.Name == "Mathematics").DepartmentID,
|
||||
Instructors = new List<Instructor>()
|
||||
},
|
||||
new Course {CourseID = 2021, Title = "Composition", Credits = 3,
|
||||
DepartmentID = departments.Single( s => s.Name == "English").DepartmentID,
|
||||
Instructors = new List<Instructor>()
|
||||
},
|
||||
new Course {CourseID = 2042, Title = "Literature", Credits = 4,
|
||||
DepartmentID = departments.Single( s => s.Name == "English").DepartmentID,
|
||||
Instructors = new List<Instructor>()
|
||||
},
|
||||
};
|
||||
courses.ForEach(s => context.Courses.AddOrUpdate(p => p.CourseID, s));
|
||||
context.SaveChanges();
|
||||
|
||||
var officeAssignments = new List<OfficeAssignment>
|
||||
{
|
||||
new OfficeAssignment {
|
||||
InstructorID = instructors.Single( i => i.LastName == "Fakhouri").ID,
|
||||
Location = "Smith 17" },
|
||||
new OfficeAssignment {
|
||||
InstructorID = instructors.Single( i => i.LastName == "Harui").ID,
|
||||
Location = "Gowan 27" },
|
||||
new OfficeAssignment {
|
||||
InstructorID = instructors.Single( i => i.LastName == "Kapoor").ID,
|
||||
Location = "Thompson 304" },
|
||||
};
|
||||
officeAssignments.ForEach(s => context.OfficeAssignments.AddOrUpdate(p => p.InstructorID, s));
|
||||
context.SaveChanges();
|
||||
|
||||
AddOrUpdateInstructor(context, "Chemistry", "Kapoor");
|
||||
AddOrUpdateInstructor(context, "Chemistry", "Harui");
|
||||
AddOrUpdateInstructor(context, "Microeconomics", "Zheng");
|
||||
AddOrUpdateInstructor(context, "Macroeconomics", "Zheng");
|
||||
|
||||
AddOrUpdateInstructor(context, "Calculus", "Fakhouri");
|
||||
AddOrUpdateInstructor(context, "Trigonometry", "Harui");
|
||||
AddOrUpdateInstructor(context, "Composition", "Abercrombie");
|
||||
AddOrUpdateInstructor(context, "Literature", "Abercrombie");
|
||||
|
||||
context.SaveChanges();
|
||||
|
||||
var enrollments = new List<Enrollment>
|
||||
{
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Alexander").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Chemistry" ).CourseID,
|
||||
Grade = Grade.A
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Alexander").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Microeconomics" ).CourseID,
|
||||
Grade = Grade.C
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Alexander").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Macroeconomics" ).CourseID,
|
||||
Grade = Grade.B
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Alonso").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Calculus" ).CourseID,
|
||||
Grade = Grade.B
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Alonso").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Trigonometry" ).CourseID,
|
||||
Grade = Grade.B
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Alonso").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Composition" ).CourseID,
|
||||
Grade = Grade.B
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Anand").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Chemistry" ).CourseID
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Anand").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Microeconomics").CourseID,
|
||||
Grade = Grade.B
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Barzdukas").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Chemistry").CourseID,
|
||||
Grade = Grade.B
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Li").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Composition").CourseID,
|
||||
Grade = Grade.B
|
||||
},
|
||||
new Enrollment {
|
||||
StudentID = students.Single(s => s.LastName == "Justice").ID,
|
||||
CourseID = courses.Single(c => c.Title == "Literature").CourseID,
|
||||
Grade = Grade.B
|
||||
}
|
||||
};
|
||||
|
||||
foreach (Enrollment e in enrollments)
|
||||
{
|
||||
var enrollmentInDataBase = context.Enrollments.Where(
|
||||
s =>
|
||||
s.Student.ID == e.StudentID &&
|
||||
s.Course.CourseID == e.CourseID).SingleOrDefault();
|
||||
if (enrollmentInDataBase == null)
|
||||
{
|
||||
context.Enrollments.Add(e);
|
||||
}
|
||||
}
|
||||
context.SaveChanges();
|
||||
}
|
||||
|
||||
void AddOrUpdateInstructor(SchoolContext context, string courseTitle, string instructorName)
|
||||
{
|
||||
var crs = context.Courses.SingleOrDefault(c => c.Title == courseTitle);
|
||||
var inst = crs.Instructors.SingleOrDefault(i => i.LastName == instructorName);
|
||||
if (inst == null)
|
||||
crs.Instructors.Add(context.Instructors.Single(i => i.LastName == instructorName));
|
||||
}
|
||||
}
|
||||
}
|
||||
151
ContosoUniversity/Project_Readme.html
Normal file
151
ContosoUniversity/Project_Readme.html
Normal file
@@ -0,0 +1,151 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>Your ASP.NET application</title>
|
||||
<style>
|
||||
body {
|
||||
background: #fff;
|
||||
color: #505050;
|
||||
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
|
||||
margin: 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#header {
|
||||
background: #efefef;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 48px;
|
||||
font-weight: normal;
|
||||
margin: 0;
|
||||
padding: 0 30px;
|
||||
line-height: 150px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
background: #969696;
|
||||
padding: 0 30px;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
#main {
|
||||
padding: 5px 30px;
|
||||
}
|
||||
|
||||
.section {
|
||||
width: 21.7%;
|
||||
float: left;
|
||||
margin: 0 0 0 4%;
|
||||
}
|
||||
|
||||
.section h2 {
|
||||
font-size: 13px;
|
||||
text-transform: uppercase;
|
||||
margin: 0;
|
||||
border-bottom: 1px solid silver;
|
||||
padding-bottom: 12px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.section.first {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.section.first h2 {
|
||||
font-size: 24px;
|
||||
text-transform: none;
|
||||
margin-bottom: 25px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.section.first li {
|
||||
border-top: 1px solid silver;
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
.section.last {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
li {
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #267cb2;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="header">
|
||||
<h1>Your ASP.NET application</h1>
|
||||
<p>Congratulations! You've created a project</p>
|
||||
</div>
|
||||
|
||||
<div id="main">
|
||||
<div class="section first">
|
||||
<h2>This application consists of:</h2>
|
||||
<ul>
|
||||
<li>Sample pages showing basic nav between Home, About, and Contact</li>
|
||||
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=320754">Bootstrap</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320755">Authentication</a>, if selected, shows how to register and sign in</li>
|
||||
<li>ASP.NET features managed using <a href="http://go.microsoft.com/fwlink/?LinkID=320756">NuGet</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Customize app</h2>
|
||||
<ul>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320757">Get started with ASP.NET MVC</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320758">Change the site's theme</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320759">Add more libraries using NuGet</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320760">Configure authentication</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320761">Customize information about the website users</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320762">Get information from social providers</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320763">Add HTTP services using ASP.NET Web API</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320764">Secure your web API</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320765">Add real-time web with ASP.NET SignalR</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320766">Add components using Scaffolding</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320767">Test your app with Browser Link</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320768">Share your project</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Deploy</h2>
|
||||
<ul>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320769">Ensure your app is ready for production</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320770">Windows Azure</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320771">Hosting providers</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="section last">
|
||||
<h2>Get help</h2>
|
||||
<ul>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320772">Get help</a></li>
|
||||
<li><a href="http://go.microsoft.com/fwlink/?LinkID=320773">Get more templates</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
35
ContosoUniversity/Properties/AssemblyInfo.cs
Normal file
35
ContosoUniversity/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ContosoUniversity")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft Corp.")]
|
||||
[assembly: AssemblyProduct("ContosoUniversity")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft Corp. 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("0d6e9993-c2b5-420d-a732-c42696a44472")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
BIN
ContosoUniversity/Scripts/_references.js
Normal file
BIN
ContosoUniversity/Scripts/_references.js
Normal file
Binary file not shown.
2014
ContosoUniversity/Scripts/bootstrap.js
vendored
Normal file
2014
ContosoUniversity/Scripts/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
21
ContosoUniversity/Scripts/bootstrap.min.js
vendored
Normal file
21
ContosoUniversity/Scripts/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
2671
ContosoUniversity/Scripts/jquery-1.10.2.intellisense.js
vendored
Normal file
2671
ContosoUniversity/Scripts/jquery-1.10.2.intellisense.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9803
ContosoUniversity/Scripts/jquery-1.10.2.js
vendored
Normal file
9803
ContosoUniversity/Scripts/jquery-1.10.2.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
23
ContosoUniversity/Scripts/jquery-1.10.2.min.js
vendored
Normal file
23
ContosoUniversity/Scripts/jquery-1.10.2.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
ContosoUniversity/Scripts/jquery-1.10.2.min.map
Normal file
1
ContosoUniversity/Scripts/jquery-1.10.2.min.map
Normal file
File diff suppressed because one or more lines are too long
1302
ContosoUniversity/Scripts/jquery.validate-vsdoc.js
vendored
Normal file
1302
ContosoUniversity/Scripts/jquery.validate-vsdoc.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1245
ContosoUniversity/Scripts/jquery.validate.js
vendored
Normal file
1245
ContosoUniversity/Scripts/jquery.validate.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16
ContosoUniversity/Scripts/jquery.validate.min.js
vendored
Normal file
16
ContosoUniversity/Scripts/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
410
ContosoUniversity/Scripts/jquery.validate.unobtrusive.js
vendored
Normal file
410
ContosoUniversity/Scripts/jquery.validate.unobtrusive.js
vendored
Normal file
@@ -0,0 +1,410 @@
|
||||
/* NUGET: BEGIN LICENSE TEXT
|
||||
*
|
||||
* Microsoft grants you the right to use these script files for the sole
|
||||
* purpose of either: (i) interacting through your browser with the Microsoft
|
||||
* website or online service, subject to the applicable licensing or use
|
||||
* terms; or (ii) using the files as included with a Microsoft product subject
|
||||
* to that product's license terms. Microsoft reserves all other rights to the
|
||||
* files not expressly granted by Microsoft, whether by implication, estoppel
|
||||
* or otherwise. Insofar as a script file is dual licensed under GPL,
|
||||
* Microsoft neither took the code under GPL nor distributes it thereunder but
|
||||
* under the terms set out in this paragraph. All notices and licenses
|
||||
* below are for informational purposes only.
|
||||
*
|
||||
* NUGET: END LICENSE TEXT */
|
||||
/*!
|
||||
** Unobtrusive validation support library for jQuery and jQuery Validate
|
||||
** Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
|
||||
/*global document: false, jQuery: false */
|
||||
|
||||
(function ($) {
|
||||
var $jQval = $.validator,
|
||||
adapters,
|
||||
data_validation = "unobtrusiveValidation";
|
||||
|
||||
function setValidationValues(options, ruleName, value) {
|
||||
options.rules[ruleName] = value;
|
||||
if (options.message) {
|
||||
options.messages[ruleName] = options.message;
|
||||
}
|
||||
}
|
||||
|
||||
function splitAndTrim(value) {
|
||||
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
|
||||
}
|
||||
|
||||
function escapeAttributeValue(value) {
|
||||
// As mentioned on http://api.jquery.com/category/selectors/
|
||||
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
|
||||
}
|
||||
|
||||
function getModelPrefix(fieldName) {
|
||||
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
|
||||
}
|
||||
|
||||
function appendModelPrefix(value, prefix) {
|
||||
if (value.indexOf("*.") === 0) {
|
||||
value = value.replace("*.", prefix);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function onError(error, inputElement) { // 'this' is the form element
|
||||
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
|
||||
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
|
||||
|
||||
container.removeClass("field-validation-valid").addClass("field-validation-error");
|
||||
error.data("unobtrusiveContainer", container);
|
||||
|
||||
if (replace) {
|
||||
container.empty();
|
||||
error.removeClass("input-validation-error").appendTo(container);
|
||||
}
|
||||
else {
|
||||
error.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function onErrors(event, validator) { // 'this' is the form element
|
||||
var container = $(this).find("[data-valmsg-summary=true]"),
|
||||
list = container.find("ul");
|
||||
|
||||
if (list && list.length && validator.errorList.length) {
|
||||
list.empty();
|
||||
container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
|
||||
|
||||
$.each(validator.errorList, function () {
|
||||
$("<li />").html(this.message).appendTo(list);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onSuccess(error) { // 'this' is the form element
|
||||
var container = error.data("unobtrusiveContainer"),
|
||||
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
|
||||
|
||||
if (container) {
|
||||
container.addClass("field-validation-valid").removeClass("field-validation-error");
|
||||
error.removeData("unobtrusiveContainer");
|
||||
|
||||
if (replace) {
|
||||
container.empty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onReset(event) { // 'this' is the form element
|
||||
var $form = $(this);
|
||||
$form.data("validator").resetForm();
|
||||
$form.find(".validation-summary-errors")
|
||||
.addClass("validation-summary-valid")
|
||||
.removeClass("validation-summary-errors");
|
||||
$form.find(".field-validation-error")
|
||||
.addClass("field-validation-valid")
|
||||
.removeClass("field-validation-error")
|
||||
.removeData("unobtrusiveContainer")
|
||||
.find(">*") // If we were using valmsg-replace, get the underlying error
|
||||
.removeData("unobtrusiveContainer");
|
||||
}
|
||||
|
||||
function validationInfo(form) {
|
||||
var $form = $(form),
|
||||
result = $form.data(data_validation),
|
||||
onResetProxy = $.proxy(onReset, form),
|
||||
defaultOptions = $jQval.unobtrusive.options || {},
|
||||
execInContext = function (name, args) {
|
||||
var func = defaultOptions[name];
|
||||
func && $.isFunction(func) && func.apply(form, args);
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
result = {
|
||||
options: { // options structure passed to jQuery Validate's validate() method
|
||||
errorClass: defaultOptions.errorClass || "input-validation-error",
|
||||
errorElement: defaultOptions.errorElement || "span",
|
||||
errorPlacement: function () {
|
||||
onError.apply(form, arguments);
|
||||
execInContext("errorPlacement", arguments);
|
||||
},
|
||||
invalidHandler: function () {
|
||||
onErrors.apply(form, arguments);
|
||||
execInContext("invalidHandler", arguments);
|
||||
},
|
||||
messages: {},
|
||||
rules: {},
|
||||
success: function () {
|
||||
onSuccess.apply(form, arguments);
|
||||
execInContext("success", arguments);
|
||||
}
|
||||
},
|
||||
attachValidation: function () {
|
||||
$form
|
||||
.off("reset." + data_validation, onResetProxy)
|
||||
.on("reset." + data_validation, onResetProxy)
|
||||
.validate(this.options);
|
||||
},
|
||||
validate: function () { // a validation function that is called by unobtrusive Ajax
|
||||
$form.validate();
|
||||
return $form.valid();
|
||||
}
|
||||
};
|
||||
$form.data(data_validation, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
$jQval.unobtrusive = {
|
||||
adapters: [],
|
||||
|
||||
parseElement: function (element, skipAttach) {
|
||||
/// <summary>
|
||||
/// Parses a single HTML element for unobtrusive validation attributes.
|
||||
/// </summary>
|
||||
/// <param name="element" domElement="true">The HTML element to be parsed.</param>
|
||||
/// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the
|
||||
/// validation to the form. If parsing just this single element, you should specify true.
|
||||
/// If parsing several elements, you should specify false, and manually attach the validation
|
||||
/// to the form when you are finished. The default is false.</param>
|
||||
var $element = $(element),
|
||||
form = $element.parents("form")[0],
|
||||
valInfo, rules, messages;
|
||||
|
||||
if (!form) { // Cannot do client-side validation without a form
|
||||
return;
|
||||
}
|
||||
|
||||
valInfo = validationInfo(form);
|
||||
valInfo.options.rules[element.name] = rules = {};
|
||||
valInfo.options.messages[element.name] = messages = {};
|
||||
|
||||
$.each(this.adapters, function () {
|
||||
var prefix = "data-val-" + this.name,
|
||||
message = $element.attr(prefix),
|
||||
paramValues = {};
|
||||
|
||||
if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
|
||||
prefix += "-";
|
||||
|
||||
$.each(this.params, function () {
|
||||
paramValues[this] = $element.attr(prefix + this);
|
||||
});
|
||||
|
||||
this.adapt({
|
||||
element: element,
|
||||
form: form,
|
||||
message: message,
|
||||
params: paramValues,
|
||||
rules: rules,
|
||||
messages: messages
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$.extend(rules, { "__dummy__": true });
|
||||
|
||||
if (!skipAttach) {
|
||||
valInfo.attachValidation();
|
||||
}
|
||||
},
|
||||
|
||||
parse: function (selector) {
|
||||
/// <summary>
|
||||
/// Parses all the HTML elements in the specified selector. It looks for input elements decorated
|
||||
/// with the [data-val=true] attribute value and enables validation according to the data-val-*
|
||||
/// attribute values.
|
||||
/// </summary>
|
||||
/// <param name="selector" type="String">Any valid jQuery selector.</param>
|
||||
|
||||
// $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
|
||||
// element with data-val=true
|
||||
var $selector = $(selector),
|
||||
$forms = $selector.parents()
|
||||
.addBack()
|
||||
.filter("form")
|
||||
.add($selector.find("form"))
|
||||
.has("[data-val=true]");
|
||||
|
||||
$selector.find("[data-val=true]").each(function () {
|
||||
$jQval.unobtrusive.parseElement(this, true);
|
||||
});
|
||||
|
||||
$forms.each(function () {
|
||||
var info = validationInfo(this);
|
||||
if (info) {
|
||||
info.attachValidation();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
adapters = $jQval.unobtrusive.adapters;
|
||||
|
||||
adapters.add = function (adapterName, params, fn) {
|
||||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>
|
||||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||
/// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will
|
||||
/// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
|
||||
/// mmmm is the parameter name).</param>
|
||||
/// <param name="fn" type="Function">The function to call, which adapts the values from the HTML
|
||||
/// attributes into jQuery Validate rules and/or messages.</param>
|
||||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||
if (!fn) { // Called with no params, just a function
|
||||
fn = params;
|
||||
params = [];
|
||||
}
|
||||
this.push({ name: adapterName, params: params, adapt: fn });
|
||||
return this;
|
||||
};
|
||||
|
||||
adapters.addBool = function (adapterName, ruleName) {
|
||||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||
/// the jQuery Validate validation rule has no parameter values.</summary>
|
||||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
||||
/// of adapterName will be used instead.</param>
|
||||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||
return this.add(adapterName, function (options) {
|
||||
setValidationValues(options, ruleName || adapterName, true);
|
||||
});
|
||||
};
|
||||
|
||||
adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
|
||||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||
/// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
|
||||
/// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>
|
||||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||
/// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
||||
/// have a minimum value.</param>
|
||||
/// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
||||
/// have a maximum value.</param>
|
||||
/// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you
|
||||
/// have both a minimum and maximum value.</param>
|
||||
/// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
||||
/// contains the minimum value. The default is "min".</param>
|
||||
/// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
||||
/// contains the maximum value. The default is "max".</param>
|
||||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||
return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
|
||||
var min = options.params.min,
|
||||
max = options.params.max;
|
||||
|
||||
if (min && max) {
|
||||
setValidationValues(options, minMaxRuleName, [min, max]);
|
||||
}
|
||||
else if (min) {
|
||||
setValidationValues(options, minRuleName, min);
|
||||
}
|
||||
else if (max) {
|
||||
setValidationValues(options, maxRuleName, max);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
adapters.addSingleVal = function (adapterName, attribute, ruleName) {
|
||||
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||
/// the jQuery Validate validation rule has a single value.</summary>
|
||||
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||
/// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>
|
||||
/// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value.
|
||||
/// The default is "val".</param>
|
||||
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
||||
/// of adapterName will be used instead.</param>
|
||||
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||
return this.add(adapterName, [attribute || "val"], function (options) {
|
||||
setValidationValues(options, ruleName || adapterName, options.params[attribute]);
|
||||
});
|
||||
};
|
||||
|
||||
$jQval.addMethod("__dummy__", function (value, element, params) {
|
||||
return true;
|
||||
});
|
||||
|
||||
$jQval.addMethod("regex", function (value, element, params) {
|
||||
var match;
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
match = new RegExp(params).exec(value);
|
||||
return (match && (match.index === 0) && (match[0].length === value.length));
|
||||
});
|
||||
|
||||
$jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
|
||||
var match;
|
||||
if (nonalphamin) {
|
||||
match = value.match(/\W/g);
|
||||
match = match && match.length >= nonalphamin;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
if ($jQval.methods.extension) {
|
||||
adapters.addSingleVal("accept", "mimtype");
|
||||
adapters.addSingleVal("extension", "extension");
|
||||
} else {
|
||||
// for backward compatibility, when the 'extension' validation method does not exist, such as with versions
|
||||
// of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
|
||||
// validating the extension, and ignore mime-type validations as they are not supported.
|
||||
adapters.addSingleVal("extension", "extension", "accept");
|
||||
}
|
||||
|
||||
adapters.addSingleVal("regex", "pattern");
|
||||
adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
|
||||
adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
|
||||
adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
|
||||
adapters.add("equalto", ["other"], function (options) {
|
||||
var prefix = getModelPrefix(options.element.name),
|
||||
other = options.params.other,
|
||||
fullOtherName = appendModelPrefix(other, prefix),
|
||||
element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
|
||||
|
||||
setValidationValues(options, "equalTo", element);
|
||||
});
|
||||
adapters.add("required", function (options) {
|
||||
// jQuery Validate equates "required" with "mandatory" for checkbox elements
|
||||
if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
|
||||
setValidationValues(options, "required", true);
|
||||
}
|
||||
});
|
||||
adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
|
||||
var value = {
|
||||
url: options.params.url,
|
||||
type: options.params.type || "GET",
|
||||
data: {}
|
||||
},
|
||||
prefix = getModelPrefix(options.element.name);
|
||||
|
||||
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
|
||||
var paramName = appendModelPrefix(fieldName, prefix);
|
||||
value.data[paramName] = function () {
|
||||
return $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']").val();
|
||||
};
|
||||
});
|
||||
|
||||
setValidationValues(options, "remote", value);
|
||||
});
|
||||
adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
|
||||
if (options.params.min) {
|
||||
setValidationValues(options, "minlength", options.params.min);
|
||||
}
|
||||
if (options.params.nonalphamin) {
|
||||
setValidationValues(options, "nonalphamin", options.params.nonalphamin);
|
||||
}
|
||||
if (options.params.regex) {
|
||||
setValidationValues(options, "regex", options.params.regex);
|
||||
}
|
||||
});
|
||||
|
||||
$(function () {
|
||||
$jQval.unobtrusive.parse(document);
|
||||
});
|
||||
}(jQuery));
|
||||
19
ContosoUniversity/Scripts/jquery.validate.unobtrusive.min.js
vendored
Normal file
19
ContosoUniversity/Scripts/jquery.validate.unobtrusive.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1416
ContosoUniversity/Scripts/modernizr-2.6.2.js
vendored
Normal file
1416
ContosoUniversity/Scripts/modernizr-2.6.2.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
340
ContosoUniversity/Scripts/respond.js
Normal file
340
ContosoUniversity/Scripts/respond.js
Normal file
@@ -0,0 +1,340 @@
|
||||
/* NUGET: BEGIN LICENSE TEXT
|
||||
*
|
||||
* Microsoft grants you the right to use these script files for the sole
|
||||
* purpose of either: (i) interacting through your browser with the Microsoft
|
||||
* website or online service, subject to the applicable licensing or use
|
||||
* terms; or (ii) using the files as included with a Microsoft product subject
|
||||
* to that product's license terms. Microsoft reserves all other rights to the
|
||||
* files not expressly granted by Microsoft, whether by implication, estoppel
|
||||
* or otherwise. Insofar as a script file is dual licensed under GPL,
|
||||
* Microsoft neither took the code under GPL nor distributes it thereunder but
|
||||
* under the terms set out in this paragraph. All notices and licenses
|
||||
* below are for informational purposes only.
|
||||
*
|
||||
* NUGET: END LICENSE TEXT */
|
||||
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
|
||||
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
|
||||
window.matchMedia = window.matchMedia || (function(doc, undefined){
|
||||
|
||||
var bool,
|
||||
docElem = doc.documentElement,
|
||||
refNode = docElem.firstElementChild || docElem.firstChild,
|
||||
// fakeBody required for <FF4 when executed in <head>
|
||||
fakeBody = doc.createElement('body'),
|
||||
div = doc.createElement('div');
|
||||
|
||||
div.id = 'mq-test-1';
|
||||
div.style.cssText = "position:absolute;top:-100em";
|
||||
fakeBody.style.background = "none";
|
||||
fakeBody.appendChild(div);
|
||||
|
||||
return function(q){
|
||||
|
||||
div.innerHTML = '­<style media="'+q+'"> #mq-test-1 { width: 42px; }</style>';
|
||||
|
||||
docElem.insertBefore(fakeBody, refNode);
|
||||
bool = div.offsetWidth == 42;
|
||||
docElem.removeChild(fakeBody);
|
||||
|
||||
return { matches: bool, media: q };
|
||||
};
|
||||
|
||||
})(document);
|
||||
|
||||
|
||||
|
||||
|
||||
/*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
||||
(function( win ){
|
||||
//exposed namespace
|
||||
win.respond = {};
|
||||
|
||||
//define update even in native-mq-supporting browsers, to avoid errors
|
||||
respond.update = function(){};
|
||||
|
||||
//expose media query support flag for external use
|
||||
respond.mediaQueriesSupported = win.matchMedia && win.matchMedia( "only all" ).matches;
|
||||
|
||||
//if media queries are supported, exit here
|
||||
if( respond.mediaQueriesSupported ){ return; }
|
||||
|
||||
//define vars
|
||||
var doc = win.document,
|
||||
docElem = doc.documentElement,
|
||||
mediastyles = [],
|
||||
rules = [],
|
||||
appendedEls = [],
|
||||
parsedSheets = {},
|
||||
resizeThrottle = 30,
|
||||
head = doc.getElementsByTagName( "head" )[0] || docElem,
|
||||
base = doc.getElementsByTagName( "base" )[0],
|
||||
links = head.getElementsByTagName( "link" ),
|
||||
requestQueue = [],
|
||||
|
||||
//loop stylesheets, send text content to translate
|
||||
ripCSS = function(){
|
||||
var sheets = links,
|
||||
sl = sheets.length,
|
||||
i = 0,
|
||||
//vars for loop:
|
||||
sheet, href, media, isCSS;
|
||||
|
||||
for( ; i < sl; i++ ){
|
||||
sheet = sheets[ i ],
|
||||
href = sheet.href,
|
||||
media = sheet.media,
|
||||
isCSS = sheet.rel && sheet.rel.toLowerCase() === "stylesheet";
|
||||
|
||||
//only links plz and prevent re-parsing
|
||||
if( !!href && isCSS && !parsedSheets[ href ] ){
|
||||
// selectivizr exposes css through the rawCssText expando
|
||||
if (sheet.styleSheet && sheet.styleSheet.rawCssText) {
|
||||
translate( sheet.styleSheet.rawCssText, href, media );
|
||||
parsedSheets[ href ] = true;
|
||||
} else {
|
||||
if( (!/^([a-zA-Z:]*\/\/)/.test( href ) && !base)
|
||||
|| href.replace( RegExp.$1, "" ).split( "/" )[0] === win.location.host ){
|
||||
requestQueue.push( {
|
||||
href: href,
|
||||
media: media
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
makeRequests();
|
||||
},
|
||||
|
||||
//recurse through request queue, get css text
|
||||
makeRequests = function(){
|
||||
if( requestQueue.length ){
|
||||
var thisRequest = requestQueue.shift();
|
||||
|
||||
ajax( thisRequest.href, function( styles ){
|
||||
translate( styles, thisRequest.href, thisRequest.media );
|
||||
parsedSheets[ thisRequest.href ] = true;
|
||||
makeRequests();
|
||||
} );
|
||||
}
|
||||
},
|
||||
|
||||
//find media blocks in css text, convert to style blocks
|
||||
translate = function( styles, href, media ){
|
||||
var qs = styles.match( /@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi ),
|
||||
ql = qs && qs.length || 0,
|
||||
//try to get CSS path
|
||||
href = href.substring( 0, href.lastIndexOf( "/" )),
|
||||
repUrls = function( css ){
|
||||
return css.replace( /(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g, "$1" + href + "$2$3" );
|
||||
},
|
||||
useMedia = !ql && media,
|
||||
//vars used in loop
|
||||
i = 0,
|
||||
j, fullq, thisq, eachq, eql;
|
||||
|
||||
//if path exists, tack on trailing slash
|
||||
if( href.length ){ href += "/"; }
|
||||
|
||||
//if no internal queries exist, but media attr does, use that
|
||||
//note: this currently lacks support for situations where a media attr is specified on a link AND
|
||||
//its associated stylesheet has internal CSS media queries.
|
||||
//In those cases, the media attribute will currently be ignored.
|
||||
if( useMedia ){
|
||||
ql = 1;
|
||||
}
|
||||
|
||||
|
||||
for( ; i < ql; i++ ){
|
||||
j = 0;
|
||||
|
||||
//media attr
|
||||
if( useMedia ){
|
||||
fullq = media;
|
||||
rules.push( repUrls( styles ) );
|
||||
}
|
||||
//parse for styles
|
||||
else{
|
||||
fullq = qs[ i ].match( /@media *([^\{]+)\{([\S\s]+?)$/ ) && RegExp.$1;
|
||||
rules.push( RegExp.$2 && repUrls( RegExp.$2 ) );
|
||||
}
|
||||
|
||||
eachq = fullq.split( "," );
|
||||
eql = eachq.length;
|
||||
|
||||
for( ; j < eql; j++ ){
|
||||
thisq = eachq[ j ];
|
||||
mediastyles.push( {
|
||||
media : thisq.split( "(" )[ 0 ].match( /(only\s+)?([a-zA-Z]+)\s?/ ) && RegExp.$2 || "all",
|
||||
rules : rules.length - 1,
|
||||
hasquery: thisq.indexOf("(") > -1,
|
||||
minw : thisq.match( /\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" ),
|
||||
maxw : thisq.match( /\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/ ) && parseFloat( RegExp.$1 ) + ( RegExp.$2 || "" )
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
applyMedia();
|
||||
},
|
||||
|
||||
lastCall,
|
||||
|
||||
resizeDefer,
|
||||
|
||||
// returns the value of 1em in pixels
|
||||
getEmValue = function() {
|
||||
var ret,
|
||||
div = doc.createElement('div'),
|
||||
body = doc.body,
|
||||
fakeUsed = false;
|
||||
|
||||
div.style.cssText = "position:absolute;font-size:1em;width:1em";
|
||||
|
||||
if( !body ){
|
||||
body = fakeUsed = doc.createElement( "body" );
|
||||
body.style.background = "none";
|
||||
}
|
||||
|
||||
body.appendChild( div );
|
||||
|
||||
docElem.insertBefore( body, docElem.firstChild );
|
||||
|
||||
ret = div.offsetWidth;
|
||||
|
||||
if( fakeUsed ){
|
||||
docElem.removeChild( body );
|
||||
}
|
||||
else {
|
||||
body.removeChild( div );
|
||||
}
|
||||
|
||||
//also update eminpx before returning
|
||||
ret = eminpx = parseFloat(ret);
|
||||
|
||||
return ret;
|
||||
},
|
||||
|
||||
//cached container for 1em value, populated the first time it's needed
|
||||
eminpx,
|
||||
|
||||
//enable/disable styles
|
||||
applyMedia = function( fromResize ){
|
||||
var name = "clientWidth",
|
||||
docElemProp = docElem[ name ],
|
||||
currWidth = doc.compatMode === "CSS1Compat" && docElemProp || doc.body[ name ] || docElemProp,
|
||||
styleBlocks = {},
|
||||
lastLink = links[ links.length-1 ],
|
||||
now = (new Date()).getTime();
|
||||
|
||||
//throttle resize calls
|
||||
if( fromResize && lastCall && now - lastCall < resizeThrottle ){
|
||||
clearTimeout( resizeDefer );
|
||||
resizeDefer = setTimeout( applyMedia, resizeThrottle );
|
||||
return;
|
||||
}
|
||||
else {
|
||||
lastCall = now;
|
||||
}
|
||||
|
||||
for( var i in mediastyles ){
|
||||
var thisstyle = mediastyles[ i ],
|
||||
min = thisstyle.minw,
|
||||
max = thisstyle.maxw,
|
||||
minnull = min === null,
|
||||
maxnull = max === null,
|
||||
em = "em";
|
||||
|
||||
if( !!min ){
|
||||
min = parseFloat( min ) * ( min.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
|
||||
}
|
||||
if( !!max ){
|
||||
max = parseFloat( max ) * ( max.indexOf( em ) > -1 ? ( eminpx || getEmValue() ) : 1 );
|
||||
}
|
||||
|
||||
// if there's no media query at all (the () part), or min or max is not null, and if either is present, they're true
|
||||
if( !thisstyle.hasquery || ( !minnull || !maxnull ) && ( minnull || currWidth >= min ) && ( maxnull || currWidth <= max ) ){
|
||||
if( !styleBlocks[ thisstyle.media ] ){
|
||||
styleBlocks[ thisstyle.media ] = [];
|
||||
}
|
||||
styleBlocks[ thisstyle.media ].push( rules[ thisstyle.rules ] );
|
||||
}
|
||||
}
|
||||
|
||||
//remove any existing respond style element(s)
|
||||
for( var i in appendedEls ){
|
||||
if( appendedEls[ i ] && appendedEls[ i ].parentNode === head ){
|
||||
head.removeChild( appendedEls[ i ] );
|
||||
}
|
||||
}
|
||||
|
||||
//inject active styles, grouped by media type
|
||||
for( var i in styleBlocks ){
|
||||
var ss = doc.createElement( "style" ),
|
||||
css = styleBlocks[ i ].join( "\n" );
|
||||
|
||||
ss.type = "text/css";
|
||||
ss.media = i;
|
||||
|
||||
//originally, ss was appended to a documentFragment and sheets were appended in bulk.
|
||||
//this caused crashes in IE in a number of circumstances, such as when the HTML element had a bg image set, so appending beforehand seems best. Thanks to @dvelyk for the initial research on this one!
|
||||
head.insertBefore( ss, lastLink.nextSibling );
|
||||
|
||||
if ( ss.styleSheet ){
|
||||
ss.styleSheet.cssText = css;
|
||||
}
|
||||
else {
|
||||
ss.appendChild( doc.createTextNode( css ) );
|
||||
}
|
||||
|
||||
//push to appendedEls to track for later removal
|
||||
appendedEls.push( ss );
|
||||
}
|
||||
},
|
||||
//tweaked Ajax functions from Quirksmode
|
||||
ajax = function( url, callback ) {
|
||||
var req = xmlHttp();
|
||||
if (!req){
|
||||
return;
|
||||
}
|
||||
req.open( "GET", url, true );
|
||||
req.onreadystatechange = function () {
|
||||
if ( req.readyState != 4 || req.status != 200 && req.status != 304 ){
|
||||
return;
|
||||
}
|
||||
callback( req.responseText );
|
||||
}
|
||||
if ( req.readyState == 4 ){
|
||||
return;
|
||||
}
|
||||
req.send( null );
|
||||
},
|
||||
//define ajax obj
|
||||
xmlHttp = (function() {
|
||||
var xmlhttpmethod = false;
|
||||
try {
|
||||
xmlhttpmethod = new XMLHttpRequest();
|
||||
}
|
||||
catch( e ){
|
||||
xmlhttpmethod = new ActiveXObject( "Microsoft.XMLHTTP" );
|
||||
}
|
||||
return function(){
|
||||
return xmlhttpmethod;
|
||||
};
|
||||
})();
|
||||
|
||||
//translate CSS
|
||||
ripCSS();
|
||||
|
||||
//expose update for re-running respond later on
|
||||
respond.update = ripCSS;
|
||||
|
||||
//adjust on resize
|
||||
function callMedia(){
|
||||
applyMedia( true );
|
||||
}
|
||||
if( win.addEventListener ){
|
||||
win.addEventListener( "resize", callMedia, false );
|
||||
}
|
||||
else if( win.attachEvent ){
|
||||
win.attachEvent( "onresize", callMedia );
|
||||
}
|
||||
})(this);
|
||||
20
ContosoUniversity/Scripts/respond.min.js
vendored
Normal file
20
ContosoUniversity/Scripts/respond.min.js
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/* NUGET: BEGIN LICENSE TEXT
|
||||
*
|
||||
* Microsoft grants you the right to use these script files for the sole
|
||||
* purpose of either: (i) interacting through your browser with the Microsoft
|
||||
* website or online service, subject to the applicable licensing or use
|
||||
* terms; or (ii) using the files as included with a Microsoft product subject
|
||||
* to that product's license terms. Microsoft reserves all other rights to the
|
||||
* files not expressly granted by Microsoft, whether by implication, estoppel
|
||||
* or otherwise. Insofar as a script file is dual licensed under GPL,
|
||||
* Microsoft neither took the code under GPL nor distributes it thereunder but
|
||||
* under the terms set out in this paragraph. All notices and licenses
|
||||
* below are for informational purposes only.
|
||||
*
|
||||
* NUGET: END LICENSE TEXT */
|
||||
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
|
||||
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
|
||||
window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='­<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);
|
||||
|
||||
/*! Respond.js v1.2.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
||||
(function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B<y;B++){A=D[B],z=A.href,C=A.media,x=A.rel&&A.rel.toLowerCase()==="stylesheet";if(!!z&&x&&!o[z]){if(A.styleSheet&&A.styleSheet.rawCssText){m(A.styleSheet.rawCssText,z,C);o[z]=true}else{if((!/^([a-zA-Z:]*\/\/)/.test(z)&&!g)||z.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:z,media:C})}}}}u()},u=function(){if(d.length){var x=d.shift();n(x.href,function(y){m(y,x.href,x.media);o[x.href]=true;u()})}},m=function(I,x,z){var G=I.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),J=G&&G.length||0,x=x.substring(0,x.lastIndexOf("/")),y=function(K){return K.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+x+"$2$3")},A=!J&&z,D=0,C,E,F,B,H;if(x.length){x+="/"}if(A){J=1}for(;D<J;D++){C=0;if(A){E=z;k.push(y(I))}else{E=G[D].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&y(RegExp.$2))}B=E.split(",");H=B.length;for(;C<H;C++){F=B[C];i.push({media:F.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:k.length-1,hasquery:F.indexOf("(")>-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l<h){clearTimeout(r);r=setTimeout(j,h);return}else{l=z}for(var E in i){var K=i[E],C=K.minw,J=K.maxw,A=C===null,L=J===null,y="em";if(!!C){C=parseFloat(C)*(C.indexOf(y)>-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this);
|
||||
9
ContosoUniversity/ViewModels/AssignedCourseData.cs
Normal file
9
ContosoUniversity/ViewModels/AssignedCourseData.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace ContosoUniversity.ViewModels
|
||||
{
|
||||
public class AssignedCourseData
|
||||
{
|
||||
public int CourseID { get; set; }
|
||||
public string Title { get; set; }
|
||||
public bool Assigned { get; set; }
|
||||
}
|
||||
}
|
||||
13
ContosoUniversity/ViewModels/EnrollmentDateGroup.cs
Normal file
13
ContosoUniversity/ViewModels/EnrollmentDateGroup.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ContosoUniversity.ViewModels
|
||||
{
|
||||
public class EnrollmentDateGroup
|
||||
{
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime? EnrollmentDate { get; set; }
|
||||
|
||||
public int StudentCount { get; set; }
|
||||
}
|
||||
}
|
||||
13
ContosoUniversity/ViewModels/InstructorIndexData.cs
Normal file
13
ContosoUniversity/ViewModels/InstructorIndexData.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using ContosoUniversity.Models;
|
||||
|
||||
namespace ContosoUniversity.ViewModels
|
||||
{
|
||||
public class InstructorIndexData
|
||||
{
|
||||
public IEnumerable<Instructor> Instructors { get; set; }
|
||||
public IEnumerable<Course> Courses { get; set; }
|
||||
public IEnumerable<Enrollment> Enrollments { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
64
ContosoUniversity/Views/Course/Create.cshtml
Normal file
64
ContosoUniversity/Views/Course/Create.cshtml
Normal file
@@ -0,0 +1,64 @@
|
||||
@model ContosoUniversity.Models.Course
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Create";
|
||||
}
|
||||
|
||||
<h2>Create</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>Course</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.CourseID, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.CourseID, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.CourseID, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Credits, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Credits, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Credits, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="DepartmentID">Department</label>
|
||||
<div class="col-md-10">
|
||||
@Html.DropDownList("DepartmentID", null, htmlAttributes: new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(model => model.DepartmentID, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
56
ContosoUniversity/Views/Course/Delete.cshtml
Normal file
56
ContosoUniversity/Views/Course/Delete.cshtml
Normal file
@@ -0,0 +1,56 @@
|
||||
@model ContosoUniversity.Models.Course
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>Course</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
Department
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Department.Name)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.CourseID)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.CourseID)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Title)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Title)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Credits)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Credits)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
@using (Html.BeginForm()) {
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
50
ContosoUniversity/Views/Course/Details.cshtml
Normal file
50
ContosoUniversity/Views/Course/Details.cshtml
Normal file
@@ -0,0 +1,50 @@
|
||||
@model ContosoUniversity.Models.Course
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
||||
<div>
|
||||
<h4>Course</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
Department
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Department.Name)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.CourseID)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.CourseID)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Title)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Title)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Credits)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Credits)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.CourseID }) |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</p>
|
||||
65
ContosoUniversity/Views/Course/Edit.cshtml
Normal file
65
ContosoUniversity/Views/Course/Edit.cshtml
Normal file
@@ -0,0 +1,65 @@
|
||||
@model ContosoUniversity.Models.Course
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>Course</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.CourseID)
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.CourseID, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.DisplayFor(model => model.CourseID)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Credits, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Credits, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Credits, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-2" for="DepartmentID">Department</label>
|
||||
<div class="col-md-10">
|
||||
@Html.DropDownList("DepartmentID", null, htmlAttributes: new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(model => model.DepartmentID, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
61
ContosoUniversity/Views/Course/Index.cshtml
Normal file
61
ContosoUniversity/Views/Course/Index.cshtml
Normal file
@@ -0,0 +1,61 @@
|
||||
@model IEnumerable<ContosoUniversity.Models.Course>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Courses";
|
||||
}
|
||||
|
||||
<h2>Courses</h2>
|
||||
|
||||
<p>
|
||||
@Html.ActionLink("Create New", "Create")
|
||||
</p>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
<p>
|
||||
Select Department: @Html.DropDownList("SelectedDepartment", "All")
|
||||
<input type="submit" value="Filter" />
|
||||
</p>
|
||||
}
|
||||
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.CourseID)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Title)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Credits)
|
||||
</th>
|
||||
<th>
|
||||
Department
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CourseID)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Title)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Credits)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Department.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = item.CourseID }) |
|
||||
@Html.ActionLink("Details", "Details", new { id = item.CourseID }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { id = item.CourseID })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>
|
||||
30
ContosoUniversity/Views/Course/UpdateCourseCredits.cshtml
Normal file
30
ContosoUniversity/Views/Course/UpdateCourseCredits.cshtml
Normal file
@@ -0,0 +1,30 @@
|
||||
@model ContosoUniversity.Models.Course
|
||||
|
||||
@{
|
||||
ViewBag.Title = "UpdateCourseCredits";
|
||||
}
|
||||
|
||||
<h2>Update Course Credits</h2>
|
||||
|
||||
@if (ViewBag.RowsAffected == null)
|
||||
{
|
||||
using (Html.BeginForm())
|
||||
{
|
||||
<p>
|
||||
Enter a number to multiply every course's credits by: @Html.TextBox("multiplier")
|
||||
</p>
|
||||
<p>
|
||||
<input type="submit" value="Update" />
|
||||
</p>
|
||||
}
|
||||
}
|
||||
@if (ViewBag.RowsAffected != null)
|
||||
{
|
||||
<p>
|
||||
Number of rows updated: @ViewBag.RowsAffected
|
||||
</p>
|
||||
}
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
64
ContosoUniversity/Views/Department/Create.cshtml
Normal file
64
ContosoUniversity/Views/Department/Create.cshtml
Normal file
@@ -0,0 +1,64 @@
|
||||
@model ContosoUniversity.Models.Department
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Create";
|
||||
}
|
||||
|
||||
<h2>Create</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>Department</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Budget, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Budget, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Budget, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.StartDate, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.StartDate, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.StartDate, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.InstructorID, "Administrator", htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.DropDownList("InstructorID", null, htmlAttributes: new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(model => model.InstructorID, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
61
ContosoUniversity/Views/Department/Delete.cshtml
Normal file
61
ContosoUniversity/Views/Department/Delete.cshtml
Normal file
@@ -0,0 +1,61 @@
|
||||
@model ContosoUniversity.Models.Department
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<p class="error">@ViewBag.ConcurrencyErrorMessage</p>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>Department</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
Administrator
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Administrator.FullName)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Budget)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Budget)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.StartDate)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.StartDate)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
@Html.HiddenFor(model => model.DepartmentID)
|
||||
@Html.HiddenFor(model => model.RowVersion)
|
||||
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
49
ContosoUniversity/Views/Department/Details.cshtml
Normal file
49
ContosoUniversity/Views/Department/Details.cshtml
Normal file
@@ -0,0 +1,49 @@
|
||||
@model ContosoUniversity.Models.Department
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
||||
<div>
|
||||
<h4>Department</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Name)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.Budget)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Budget)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.StartDate)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.StartDate)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
Administrator
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.Administrator.FullName)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.DepartmentID }) |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</p>
|
||||
67
ContosoUniversity/Views/Department/Edit.cshtml
Normal file
67
ContosoUniversity/Views/Department/Edit.cshtml
Normal file
@@ -0,0 +1,67 @@
|
||||
@model ContosoUniversity.Models.Department
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>Department</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.DepartmentID)
|
||||
@Html.HiddenFor(model => model.RowVersion)
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Name, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Name, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Name, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.Budget, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.Budget, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.Budget, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.StartDate, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.StartDate, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.StartDate, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.InstructorID, "Administrator", htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.DropDownList("InstructorID", null, htmlAttributes: new { @class = "form-control" })
|
||||
@Html.ValidationMessageFor(model => model.InstructorID, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
47
ContosoUniversity/Views/Department/Index.cshtml
Normal file
47
ContosoUniversity/Views/Department/Index.cshtml
Normal file
@@ -0,0 +1,47 @@
|
||||
@model IEnumerable<ContosoUniversity.Models.Department>
|
||||
@{
|
||||
ViewBag.Title = "Departments";
|
||||
}
|
||||
<h2>Departments</h2>
|
||||
<p>
|
||||
@Html.ActionLink("Create New", "Create")
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.Budget)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.StartDate)
|
||||
</th>
|
||||
<th>
|
||||
Administrator
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Budget)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.StartDate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Administrator.FullName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = item.DepartmentID }) |
|
||||
@Html.ActionLink("Details", "Details", new { id = item.DepartmentID }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { id = item.DepartmentID })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
30
ContosoUniversity/Views/Home/About.cshtml
Normal file
30
ContosoUniversity/Views/Home/About.cshtml
Normal file
@@ -0,0 +1,30 @@
|
||||
@model IEnumerable<ContosoUniversity.ViewModels.EnrollmentDateGroup>
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Student Body Statistics";
|
||||
}
|
||||
|
||||
<h2>Student Body Statistics</h2>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>
|
||||
Enrollment Date
|
||||
</th>
|
||||
<th>
|
||||
Students
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.EnrollmentDate)
|
||||
</td>
|
||||
<td>
|
||||
@item.StudentCount
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
17
ContosoUniversity/Views/Home/Contact.cshtml
Normal file
17
ContosoUniversity/Views/Home/Contact.cshtml
Normal file
@@ -0,0 +1,17 @@
|
||||
@{
|
||||
ViewBag.Title = "Contact";
|
||||
}
|
||||
<h2>@ViewBag.Title.</h2>
|
||||
<h3>@ViewBag.Message</h3>
|
||||
|
||||
<address>
|
||||
One Microsoft Way<br />
|
||||
Redmond, WA 98052-6399<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
425.555.0100
|
||||
</address>
|
||||
|
||||
<address>
|
||||
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||
</address>
|
||||
27
ContosoUniversity/Views/Home/Index.cshtml
Normal file
27
ContosoUniversity/Views/Home/Index.cshtml
Normal file
@@ -0,0 +1,27 @@
|
||||
@{
|
||||
ViewBag.Title = "Home Page";
|
||||
}
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>Contoso University</h1>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h2>Welcome to Contoso University</h2>
|
||||
<p>
|
||||
Contoso University is a sample application that
|
||||
demonstrates how to use Entity Framework 6 in an
|
||||
ASP.NET MVC 5 web application.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>Build it from scratch</h2>
|
||||
<p>You can build the application by following the steps in the tutorial series on the ASP.NET site.</p>
|
||||
<p><a class="btn btn-default" href="http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/">See the tutorial »</a></p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>Download it</h2>
|
||||
<p>You can download the completed project from the Microsoft Code Gallery.</p>
|
||||
<p><a class="btn btn-default" href="http://code.msdn.microsoft.com/ASPNET-MVC-Application-b01a9fe8">Download »</a></p>
|
||||
</div>
|
||||
</div>
|
||||
92
ContosoUniversity/Views/Instructor/Create.cshtml
Normal file
92
ContosoUniversity/Views/Instructor/Create.cshtml
Normal file
@@ -0,0 +1,92 @@
|
||||
@model ContosoUniversity.Models.Instructor
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Create";
|
||||
}
|
||||
|
||||
<h2>Create</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>Instructor</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.FirstMidName, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.FirstMidName, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.FirstMidName, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.HireDate, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.HireDate, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.HireDate, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.OfficeAssignment.Location, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.OfficeAssignment.Location)
|
||||
@Html.ValidationMessageFor(model => model.OfficeAssignment.Location)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<table>
|
||||
<tr>
|
||||
@{
|
||||
int cnt = 0;
|
||||
List<ContosoUniversity.ViewModels.AssignedCourseData> courses = ViewBag.Courses;
|
||||
|
||||
foreach (var course in courses)
|
||||
{
|
||||
if (cnt++ % 3 == 0)
|
||||
{
|
||||
@:</tr><tr>
|
||||
}
|
||||
@:<td>
|
||||
<input type="checkbox"
|
||||
name="selectedCourses"
|
||||
value="@course.CourseID"
|
||||
@(Html.Raw(course.Assigned ? "checked=\"checked\"" : "")) />
|
||||
@course.CourseID @: @course.Title
|
||||
@:</td>
|
||||
}
|
||||
@:</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
56
ContosoUniversity/Views/Instructor/Delete.cshtml
Normal file
56
ContosoUniversity/Views/Instructor/Delete.cshtml
Normal file
@@ -0,0 +1,56 @@
|
||||
@model ContosoUniversity.Models.Instructor
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>Instructor</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.OfficeAssignment.Location)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.OfficeAssignment.Location)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.LastName)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.LastName)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.FirstMidName)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.FirstMidName)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.HireDate)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.HireDate)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
|
||||
@using (Html.BeginForm()) {
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-actions no-color">
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
50
ContosoUniversity/Views/Instructor/Details.cshtml
Normal file
50
ContosoUniversity/Views/Instructor/Details.cshtml
Normal file
@@ -0,0 +1,50 @@
|
||||
@model ContosoUniversity.Models.Instructor
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
||||
<div>
|
||||
<h4>Instructor</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.OfficeAssignment.Location)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.OfficeAssignment.Location)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.LastName)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.LastName)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.FirstMidName)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.FirstMidName)
|
||||
</dd>
|
||||
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.HireDate)
|
||||
</dt>
|
||||
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.HireDate)
|
||||
</dd>
|
||||
|
||||
</dl>
|
||||
</div>
|
||||
<p>
|
||||
@Html.ActionLink("Edit", "Edit", new { id = Model.ID }) |
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</p>
|
||||
94
ContosoUniversity/Views/Instructor/Edit.cshtml
Normal file
94
ContosoUniversity/Views/Instructor/Edit.cshtml
Normal file
@@ -0,0 +1,94 @@
|
||||
@model ContosoUniversity.Models.Instructor
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
|
||||
|
||||
@using (Html.BeginForm())
|
||||
{
|
||||
@Html.AntiForgeryToken()
|
||||
|
||||
<div class="form-horizontal">
|
||||
<h4>Instructor</h4>
|
||||
<hr />
|
||||
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
|
||||
@Html.HiddenFor(model => model.ID)
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.FirstMidName, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.FirstMidName, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.FirstMidName, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.HireDate, htmlAttributes: new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.HireDate, new { htmlAttributes = new { @class = "form-control" } })
|
||||
@Html.ValidationMessageFor(model => model.HireDate, "", new { @class = "text-danger" })
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@Html.LabelFor(model => model.OfficeAssignment.Location, new { @class = "control-label col-md-2" })
|
||||
<div class="col-md-10">
|
||||
@Html.EditorFor(model => model.OfficeAssignment.Location)
|
||||
@Html.ValidationMessageFor(model => model.OfficeAssignment.Location)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<table>
|
||||
<tr>
|
||||
@{
|
||||
int cnt = 0;
|
||||
List<ContosoUniversity.ViewModels.AssignedCourseData> courses = ViewBag.Courses;
|
||||
|
||||
foreach (var course in courses)
|
||||
{
|
||||
if (cnt++ % 3 == 0)
|
||||
{
|
||||
@:</tr><tr>
|
||||
}
|
||||
@:<td>
|
||||
<input type="checkbox"
|
||||
name="selectedCourses"
|
||||
value="@course.CourseID"
|
||||
@(Html.Raw(course.Assigned ? "checked=\"checked\"" : "")) />
|
||||
@course.CourseID @: @course.Title
|
||||
@:</td>
|
||||
}
|
||||
@:</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div>
|
||||
@Html.ActionLink("Back to List", "Index")
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@Scripts.Render("~/bundles/jqueryval")
|
||||
}
|
||||
124
ContosoUniversity/Views/Instructor/Index.cshtml
Normal file
124
ContosoUniversity/Views/Instructor/Index.cshtml
Normal file
@@ -0,0 +1,124 @@
|
||||
@model ContosoUniversity.ViewModels.InstructorIndexData
|
||||
|
||||
@{
|
||||
ViewBag.Title = "Instructors";
|
||||
}
|
||||
|
||||
<h2>Instructors</h2>
|
||||
|
||||
<p>
|
||||
@Html.ActionLink("Create New", "Create")
|
||||
</p>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Last Name</th>
|
||||
<th>First Name</th>
|
||||
<th>Hire Date</th>
|
||||
<th>Office</th>
|
||||
<th>Courses</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model.Instructors)
|
||||
{
|
||||
string selectedRow = "";
|
||||
if (item.ID == ViewBag.InstructorID)
|
||||
{
|
||||
selectedRow = "success";
|
||||
}
|
||||
<tr class="@selectedRow">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.LastName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.FirstMidName)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.HireDate)
|
||||
</td>
|
||||
<td>
|
||||
@if (item.OfficeAssignment != null)
|
||||
{
|
||||
@item.OfficeAssignment.Location
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@{
|
||||
foreach (var course in item.Courses)
|
||||
{
|
||||
@course.CourseID @: @course.Title <br />
|
||||
}
|
||||
}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
@Html.ActionLink("Select", "Index", new { id = item.ID }) |
|
||||
@Html.ActionLink("Edit", "Edit", new { id = item.ID }) |
|
||||
@Html.ActionLink("Details", "Details", new { id = item.ID }) |
|
||||
@Html.ActionLink("Delete", "Delete", new { id = item.ID })
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>
|
||||
|
||||
@if (Model.Courses != null)
|
||||
{
|
||||
<h3>Courses Taught by Selected Instructor</h3>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Number</th>
|
||||
<th>Title</th>
|
||||
<th>Department</th>
|
||||
</tr>
|
||||
|
||||
@foreach (var item in Model.Courses)
|
||||
{
|
||||
string selectedRow = "";
|
||||
if (item.CourseID == ViewBag.CourseID)
|
||||
{
|
||||
selectedRow = "success";
|
||||
}
|
||||
<tr class="@selectedRow">
|
||||
<td>
|
||||
@Html.ActionLink("Select", "Index", new { courseID = item.CourseID })
|
||||
</td>
|
||||
<td>
|
||||
@item.CourseID
|
||||
</td>
|
||||
<td>
|
||||
@item.Title
|
||||
</td>
|
||||
<td>
|
||||
@item.Department.Name
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
||||
</table>
|
||||
}
|
||||
|
||||
@if (Model.Enrollments != null)
|
||||
{
|
||||
<h3>
|
||||
Students Enrolled in Selected Course
|
||||
</h3>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Grade</th>
|
||||
</tr>
|
||||
@foreach (var item in Model.Enrollments)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@item.Student.FullName
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Grade)
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user