Using dependency injection and viewmodel etc
This commit is contained in:
14
AdventureWorks.DataLayer/AdventureWorks.DataLayer.csproj
Normal file
14
AdventureWorks.DataLayer/AdventureWorks.DataLayer.csproj
Normal file
@ -0,0 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AdventureWorks.EntityLayer\AdventureWorks.EntityLayer.csproj" />
|
||||
<ProjectReference Include="..\Common.Library\Common.Library.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
75
AdventureWorks.DataLayer/DataClasses/ColorRepository.cs
Normal file
75
AdventureWorks.DataLayer/DataClasses/ColorRepository.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using AdventureWorks.EntityLayer;
|
||||
using Common.Library;
|
||||
|
||||
namespace AdventureWorks.DataLayer;
|
||||
|
||||
/// <summary>
|
||||
/// This class creates some fake data for Colors.
|
||||
/// </summary>
|
||||
public partial class ColorRepository : IRepository<AdventureWorks.EntityLayer.Color>
|
||||
{
|
||||
#region Get Method
|
||||
/// <summary>
|
||||
/// Get all Color objects
|
||||
/// </summary>
|
||||
/// <returns>A list of Color objects</returns>
|
||||
public ObservableCollection<AdventureWorks.EntityLayer.Color> Get()
|
||||
{
|
||||
return new ObservableCollection<AdventureWorks.EntityLayer.Color>
|
||||
{
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 1,
|
||||
ColorName = "Black",
|
||||
},
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 2,
|
||||
ColorName = "Blue",
|
||||
},
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 3,
|
||||
ColorName = "Gray",
|
||||
},
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 4,
|
||||
ColorName = "Multi",
|
||||
},
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 5,
|
||||
ColorName = "Red",
|
||||
},
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 6,
|
||||
ColorName = "Silver",
|
||||
},
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 7,
|
||||
ColorName = "Silver/Black",
|
||||
},
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 8,
|
||||
ColorName = "White",
|
||||
},
|
||||
new AdventureWorks.EntityLayer.Color {
|
||||
ColorId = 9,
|
||||
ColorName = "Yellow",
|
||||
}
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Get(id) Method
|
||||
/// <summary>
|
||||
/// Get a single Color object
|
||||
/// </summary>
|
||||
/// <param name="id">The value to locate</param>
|
||||
/// <returns>A valid Color object object, or null if not found</returns>
|
||||
public AdventureWorks.EntityLayer.Color? Get(int id)
|
||||
{
|
||||
return Get().Where(row => row.ColorId == id).FirstOrDefault();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
51
AdventureWorks.DataLayer/DataClasses/PhoneTypeRepository.cs
Normal file
51
AdventureWorks.DataLayer/DataClasses/PhoneTypeRepository.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using AdventureWorks.EntityLayer;
|
||||
using Common.Library;
|
||||
|
||||
namespace AdventureWorks.DataLayer;
|
||||
|
||||
/// <summary>
|
||||
/// This class creates some fake data for Phone Types.
|
||||
/// </summary>
|
||||
public partial class PhoneTypeRepository : IRepository<PhoneType>
|
||||
{
|
||||
#region Get Method
|
||||
/// <summary>
|
||||
/// Get all PhoneType objects
|
||||
/// </summary>
|
||||
/// <returns>A list of PhoneType objects</returns>
|
||||
public ObservableCollection<PhoneType> Get()
|
||||
{
|
||||
return new ObservableCollection<PhoneType>
|
||||
{
|
||||
new PhoneType {
|
||||
PhoneTypeId = 1,
|
||||
TypeDescription = "Home",
|
||||
},
|
||||
new PhoneType {
|
||||
PhoneTypeId = 2,
|
||||
TypeDescription = "Mobile",
|
||||
},
|
||||
new PhoneType {
|
||||
PhoneTypeId = 3,
|
||||
TypeDescription = "Other",
|
||||
}
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Get(id) Method
|
||||
/// <summary>
|
||||
/// Get a single PhoneType object
|
||||
/// </summary>
|
||||
/// <param name="id">The value to locate</param>
|
||||
/// <returns>A valid PhoneType object object, or null if not found</returns>
|
||||
public PhoneType? Get(int id)
|
||||
{
|
||||
return Get().Where(row => row.PhoneTypeId == id).FirstOrDefault();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
519
AdventureWorks.DataLayer/DataClasses/ProductRepository.cs
Normal file
519
AdventureWorks.DataLayer/DataClasses/ProductRepository.cs
Normal file
@ -0,0 +1,519 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using AdventureWorks.EntityLayer;
|
||||
using Common.Library;
|
||||
|
||||
namespace AdventureWorks.DataLayer;
|
||||
|
||||
/// <summary>
|
||||
/// This class creates some fake data for Products.
|
||||
/// </summary>
|
||||
public partial class ProductRepository : IRepository<Product>
|
||||
{
|
||||
#region Get Method
|
||||
/// <summary>
|
||||
/// Get all Product objects
|
||||
/// </summary>
|
||||
/// <returns>A list of Product objects</returns>
|
||||
public ObservableCollection<Product> Get()
|
||||
{
|
||||
return new ObservableCollection<Product>
|
||||
{
|
||||
new Product {
|
||||
ProductID = 680,
|
||||
Name = @"HL Road Frame - Black, 58",
|
||||
ProductNumber = @"FR-R92B-58",
|
||||
Color = @"Black",
|
||||
StandardCost = 1059.3100m,
|
||||
ListPrice = 1431.5000m,
|
||||
Size = @"58",
|
||||
Weight = 1016.04m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 6,
|
||||
SellStartDate = Convert.ToDateTime("6/1/2002 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 706,
|
||||
Name = @"HL Road Frame - Red, 58",
|
||||
ProductNumber = @"FR-R92R-58",
|
||||
Color = @"Red",
|
||||
StandardCost = 1059.3100m,
|
||||
ListPrice = 1431.5000m,
|
||||
Size = @"58",
|
||||
Weight = 1016.04m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 6,
|
||||
SellStartDate = Convert.ToDateTime("6/1/2002 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 707,
|
||||
Name = @"Sport-100 Helmet, Red",
|
||||
ProductNumber = @"HL-U509-R",
|
||||
Color = @"Red",
|
||||
StandardCost = 13.0863m,
|
||||
ListPrice = 34.9900m,
|
||||
Size = string.Empty,
|
||||
Weight = null,
|
||||
ProductCategoryID = 35,
|
||||
ProductModelID = 33,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 708,
|
||||
Name = @"Sport-100 Helmet, Black",
|
||||
ProductNumber = @"HL-U509",
|
||||
Color = @"Black",
|
||||
StandardCost = 13.0863m,
|
||||
ListPrice = 34.9900m,
|
||||
Size = string.Empty,
|
||||
Weight = null,
|
||||
ProductCategoryID = 35,
|
||||
ProductModelID = 33,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 709,
|
||||
Name = @"Mountain Bike Socks, M",
|
||||
ProductNumber = @"SO-B909-M",
|
||||
Color = @"White",
|
||||
StandardCost = 3.3963m,
|
||||
ListPrice = 9.5000m,
|
||||
Size = @"M",
|
||||
Weight = null,
|
||||
ProductCategoryID = 27,
|
||||
ProductModelID = 18,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 710,
|
||||
Name = @"Mountain Bike Socks, L",
|
||||
ProductNumber = @"SO-B909-L",
|
||||
Color = @"White",
|
||||
StandardCost = 3.3963m,
|
||||
ListPrice = 9.5000m,
|
||||
Size = @"L",
|
||||
Weight = null,
|
||||
ProductCategoryID = 27,
|
||||
ProductModelID = 18,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 711,
|
||||
Name = @"Sport-100 Helmet, Blue",
|
||||
ProductNumber = @"HL-U509-B",
|
||||
Color = @"Blue",
|
||||
StandardCost = 13.0863m,
|
||||
ListPrice = 34.9900m,
|
||||
Size = string.Empty,
|
||||
Weight = null,
|
||||
ProductCategoryID = 35,
|
||||
ProductModelID = 33,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 712,
|
||||
Name = @"AWC Logo Cap",
|
||||
ProductNumber = @"CA-1098",
|
||||
Color = @"Multi",
|
||||
StandardCost = 6.9223m,
|
||||
ListPrice = 8.9900m,
|
||||
Size = string.Empty,
|
||||
Weight = null,
|
||||
ProductCategoryID = 23,
|
||||
ProductModelID = 2,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 713,
|
||||
Name = @"Long-Sleeve Logo Jersey, S",
|
||||
ProductNumber = @"LJ-0192-S",
|
||||
Color = @"Multi",
|
||||
StandardCost = 38.4923m,
|
||||
ListPrice = 49.9900m,
|
||||
Size = @"S",
|
||||
Weight = null,
|
||||
ProductCategoryID = 25,
|
||||
ProductModelID = 11,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 714,
|
||||
Name = @"Long-Sleeve Logo Jersey, M",
|
||||
ProductNumber = @"LJ-0192-M",
|
||||
Color = @"Multi",
|
||||
StandardCost = 38.4923m,
|
||||
ListPrice = 49.9900m,
|
||||
Size = @"M",
|
||||
Weight = null,
|
||||
ProductCategoryID = 25,
|
||||
ProductModelID = 11,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 715,
|
||||
Name = @"Long-Sleeve Logo Jersey, L",
|
||||
ProductNumber = @"LJ-0192-L",
|
||||
Color = @"Multi",
|
||||
StandardCost = 38.4923m,
|
||||
ListPrice = 49.9900m,
|
||||
Size = @"L",
|
||||
Weight = null,
|
||||
ProductCategoryID = 25,
|
||||
ProductModelID = 11,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 716,
|
||||
Name = @"Long-Sleeve Logo Jersey, XL",
|
||||
ProductNumber = @"LJ-0192-X",
|
||||
Color = @"Multi",
|
||||
StandardCost = 38.4923m,
|
||||
ListPrice = 49.9900m,
|
||||
Size = @"XL",
|
||||
Weight = null,
|
||||
ProductCategoryID = 25,
|
||||
ProductModelID = 11,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 717,
|
||||
Name = @"HL Road Frame - Red, 62",
|
||||
ProductNumber = @"FR-R92R-62",
|
||||
Color = @"Red",
|
||||
StandardCost = 868.6342m,
|
||||
ListPrice = 1431.5000m,
|
||||
Size = @"62",
|
||||
Weight = 1043.26m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 6,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 718,
|
||||
Name = @"HL Road Frame - Red, 44",
|
||||
ProductNumber = @"FR-R92R-44",
|
||||
Color = @"Red",
|
||||
StandardCost = 868.6342m,
|
||||
ListPrice = 1431.5000m,
|
||||
Size = @"44",
|
||||
Weight = 961.61m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 6,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 719,
|
||||
Name = @"HL Road Frame - Red, 48",
|
||||
ProductNumber = @"FR-R92R-48",
|
||||
Color = @"Red",
|
||||
StandardCost = 868.6342m,
|
||||
ListPrice = 1431.5000m,
|
||||
Size = @"48",
|
||||
Weight = 979.75m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 6,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 720,
|
||||
Name = @"HL Road Frame - Red, 52",
|
||||
ProductNumber = @"FR-R92R-52",
|
||||
Color = @"Red",
|
||||
StandardCost = 868.6342m,
|
||||
ListPrice = 1431.5000m,
|
||||
Size = @"52",
|
||||
Weight = 997.90m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 6,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 721,
|
||||
Name = @"HL Road Frame - Red, 56",
|
||||
ProductNumber = @"FR-R92R-56",
|
||||
Color = @"Red",
|
||||
StandardCost = 868.6342m,
|
||||
ListPrice = 1431.5000m,
|
||||
Size = @"56",
|
||||
Weight = 1016.04m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 6,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 722,
|
||||
Name = @"LL Road Frame - Black, 58",
|
||||
ProductNumber = @"FR-R38B-58",
|
||||
Color = @"Black",
|
||||
StandardCost = 204.6251m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"58",
|
||||
Weight = 1115.83m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 723,
|
||||
Name = @"LL Road Frame - Black, 60",
|
||||
ProductNumber = @"FR-R38B-60",
|
||||
Color = @"Black",
|
||||
StandardCost = 204.6251m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"60",
|
||||
Weight = 1124.90m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 724,
|
||||
Name = @"LL Road Frame - Black, 62",
|
||||
ProductNumber = @"FR-R38B-62",
|
||||
Color = @"Black",
|
||||
StandardCost = 204.6251m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"62",
|
||||
Weight = 1133.98m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = null,
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 725,
|
||||
Name = @"LL Road Frame - Red, 44",
|
||||
ProductNumber = @"FR-R38R-44",
|
||||
Color = @"Red",
|
||||
StandardCost = 187.1571m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"44",
|
||||
Weight = 1052.33m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 726,
|
||||
Name = @"LL Road Frame - Red, 48",
|
||||
ProductNumber = @"FR-R38R-48",
|
||||
Color = @"Red",
|
||||
StandardCost = 187.1571m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"48",
|
||||
Weight = 1070.47m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 727,
|
||||
Name = @"LL Road Frame - Red, 52",
|
||||
ProductNumber = @"FR-R38R-52",
|
||||
Color = @"Red",
|
||||
StandardCost = 187.1571m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"52",
|
||||
Weight = 1088.62m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 728,
|
||||
Name = @"LL Road Frame - Red, 58",
|
||||
ProductNumber = @"FR-R38R-58",
|
||||
Color = @"Red",
|
||||
StandardCost = 187.1571m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"58",
|
||||
Weight = 1115.83m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 729,
|
||||
Name = @"LL Road Frame - Red, 60",
|
||||
ProductNumber = @"FR-R38R-60",
|
||||
Color = @"Red",
|
||||
StandardCost = 187.1571m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"60",
|
||||
Weight = 1124.90m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 730,
|
||||
Name = @"LL Road Frame - Red, 62",
|
||||
ProductNumber = @"FR-R38R-62",
|
||||
Color = @"Red",
|
||||
StandardCost = 187.1571m,
|
||||
ListPrice = 337.2200m,
|
||||
Size = @"62",
|
||||
Weight = 1133.98m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 9,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2007 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 731,
|
||||
Name = @"ML Road Frame - Red, 44",
|
||||
ProductNumber = @"FR-R72R-44",
|
||||
Color = @"Red",
|
||||
StandardCost = 352.1394m,
|
||||
ListPrice = 594.8300m,
|
||||
Size = @"44",
|
||||
Weight = 1006.97m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 16,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 732,
|
||||
Name = @"ML Road Frame - Red, 48",
|
||||
ProductNumber = @"FR-R72R-48",
|
||||
Color = @"Red",
|
||||
StandardCost = 352.1394m,
|
||||
ListPrice = 594.8300m,
|
||||
Size = @"48",
|
||||
Weight = 1025.11m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 16,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 733,
|
||||
Name = @"ML Road Frame - Red, 52",
|
||||
ProductNumber = @"FR-R72R-52",
|
||||
Color = @"Red",
|
||||
StandardCost = 352.1394m,
|
||||
ListPrice = 594.8300m,
|
||||
Size = @"52",
|
||||
Weight = 1043.26m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 16,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
},
|
||||
new Product {
|
||||
ProductID = 734,
|
||||
Name = @"ML Road Frame - Red, 58",
|
||||
ProductNumber = @"FR-R72R-58",
|
||||
Color = @"Red",
|
||||
StandardCost = 352.1394m,
|
||||
ListPrice = 594.8300m,
|
||||
Size = @"58",
|
||||
Weight = 1070.47m,
|
||||
ProductCategoryID = 18,
|
||||
ProductModelID = 16,
|
||||
SellStartDate = Convert.ToDateTime("7/1/2005 12:00:00 AM"),
|
||||
SellEndDate = Convert.ToDateTime("6/30/2006 12:00:00 AM"),
|
||||
DiscontinuedDate = null,
|
||||
ModifiedDate = Convert.ToDateTime("3/11/2008 10:01:36 AM"),
|
||||
}
|
||||
};
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Get(id) Method
|
||||
/// <summary>
|
||||
/// Get a single Product object
|
||||
/// </summary>
|
||||
/// <param name="id">The value to locate</param>
|
||||
/// <returns>A valid Product object object, or null if not found</returns>
|
||||
public Product? Get(int id)
|
||||
{
|
||||
return Get().Where(row => row.ProductID == id).FirstOrDefault();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
163
AdventureWorks.DataLayer/DataClasses/UserRepository.cs
Normal file
163
AdventureWorks.DataLayer/DataClasses/UserRepository.cs
Normal file
@ -0,0 +1,163 @@
|
||||
using AdventureWorks.EntityLayer;
|
||||
using Common.Library;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace AdventureWorks.DataLayer;
|
||||
|
||||
public partial class UserRepository : IRepository<User>
|
||||
{
|
||||
#region Get Method
|
||||
public ObservableCollection<User> Get()
|
||||
{
|
||||
// This method should return a collection of User objects.
|
||||
// For now, returning an empty collection.
|
||||
return new ObservableCollection<User>()
|
||||
{
|
||||
new User
|
||||
{
|
||||
UserId = 1,
|
||||
LoginId = @"SallyJones615",
|
||||
FirstName = @"Sally",
|
||||
LastName = @"Jones",
|
||||
Email = @"sally@jones.com",
|
||||
Password = @"password123",
|
||||
Phone = @"555-1234",
|
||||
PhoneType = @"Mobile",
|
||||
IsFullTime = true,
|
||||
IsEnrolledIn401k = false,
|
||||
IsEnrolledInFlexTime = false,
|
||||
IsEnrolledInHealthCare = true,
|
||||
IsEnrolledInHSA = false,
|
||||
IsActive = true,
|
||||
BirthDate = Convert.ToDateTime("1975-11-04"),
|
||||
StartTime = new TimeSpan(8, 0, 0)
|
||||
},
|
||||
|
||||
new User
|
||||
{
|
||||
UserId = 2,
|
||||
LoginId = @"SallyJones615",
|
||||
FirstName = @"Sally",
|
||||
LastName = @"Jones",
|
||||
Email = @"sally@jones.com",
|
||||
Password = @"password123",
|
||||
Phone = @"555-1234",
|
||||
PhoneType = @"Mobile",
|
||||
IsFullTime = true,
|
||||
IsEnrolledIn401k = false,
|
||||
IsEnrolledInFlexTime = false,
|
||||
IsEnrolledInHealthCare = true,
|
||||
IsEnrolledInHSA = false,
|
||||
IsActive = true,
|
||||
BirthDate = Convert.ToDateTime("1975-11-04"),
|
||||
StartTime = new TimeSpan(8, 0, 0)
|
||||
},
|
||||
|
||||
new User
|
||||
{
|
||||
UserId = 3,
|
||||
LoginId = @"SallyJones615",
|
||||
FirstName = @"Sally",
|
||||
LastName = @"Jones",
|
||||
Email = @"sally@jones.com",
|
||||
Password = @"password123",
|
||||
Phone = @"555-1234",
|
||||
PhoneType = @"Mobile",
|
||||
IsFullTime = true,
|
||||
IsEnrolledIn401k = false,
|
||||
IsEnrolledInFlexTime = false,
|
||||
IsEnrolledInHealthCare = true,
|
||||
IsEnrolledInHSA = false,
|
||||
IsActive = true,
|
||||
BirthDate = Convert.ToDateTime("1975-11-04"),
|
||||
StartTime = new TimeSpan(8, 0, 0)
|
||||
},
|
||||
new User
|
||||
{
|
||||
UserId = 3,
|
||||
LoginId = @"SallyJones615",
|
||||
FirstName = @"Sally",
|
||||
LastName = @"Jones",
|
||||
Email = @"sally@jones.com",
|
||||
Password = @"password123",
|
||||
Phone = @"555-1234",
|
||||
PhoneType = @"Mobile",
|
||||
IsFullTime = true,
|
||||
IsEnrolledIn401k = false,
|
||||
IsEnrolledInFlexTime = false,
|
||||
IsEnrolledInHealthCare = true,
|
||||
IsEnrolledInHSA = false,
|
||||
IsActive = true,
|
||||
BirthDate = Convert.ToDateTime("1975-11-04"),
|
||||
StartTime = new TimeSpan(8, 0, 0)
|
||||
},
|
||||
new User
|
||||
{
|
||||
UserId = 4,
|
||||
LoginId = @"SallyJones615",
|
||||
FirstName = @"Sally",
|
||||
LastName = @"Jones",
|
||||
Email = @"sally@jones.com",
|
||||
Password = @"password123",
|
||||
Phone = @"555-1234",
|
||||
PhoneType = @"Mobile",
|
||||
IsFullTime = true,
|
||||
IsEnrolledIn401k = false,
|
||||
IsEnrolledInFlexTime = false,
|
||||
IsEnrolledInHealthCare = true,
|
||||
IsEnrolledInHSA = false,
|
||||
IsActive = true,
|
||||
BirthDate = Convert.ToDateTime("1975-11-04"),
|
||||
StartTime = new TimeSpan(8, 0, 0)
|
||||
},
|
||||
new User
|
||||
{
|
||||
UserId = 5,
|
||||
LoginId = @"SallyJones615",
|
||||
FirstName = @"Sally",
|
||||
LastName = @"Jones",
|
||||
Email = @"sally@jones.com",
|
||||
Password = @"password123",
|
||||
Phone = @"555-1234",
|
||||
PhoneType = @"Mobile",
|
||||
IsFullTime = true,
|
||||
IsEnrolledIn401k = false,
|
||||
IsEnrolledInFlexTime = false,
|
||||
IsEnrolledInHealthCare = true,
|
||||
IsEnrolledInHSA = false,
|
||||
IsActive = true,
|
||||
BirthDate = Convert.ToDateTime("1975-11-04"),
|
||||
StartTime = new TimeSpan(8, 0, 0)
|
||||
},
|
||||
new User
|
||||
{
|
||||
UserId = 6,
|
||||
LoginId = @"SallyJones615",
|
||||
FirstName = @"Sally",
|
||||
LastName = @"Jones",
|
||||
Email = @"sally@jones.com",
|
||||
Password = @"password123",
|
||||
Phone = @"555-1234",
|
||||
PhoneType = @"Mobile",
|
||||
IsFullTime = true,
|
||||
IsEnrolledIn401k = false,
|
||||
IsEnrolledInFlexTime = false,
|
||||
IsEnrolledInHealthCare = true,
|
||||
IsEnrolledInHSA = false,
|
||||
IsActive = true,
|
||||
BirthDate = Convert.ToDateTime("1975-11-04"),
|
||||
StartTime = new TimeSpan(8, 0, 0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
public User? Get(int id)
|
||||
{
|
||||
return Get().Where(row => row.UserId == id).FirstOrDefault();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user