-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Caitlin Hines and Tammy Dang
committed
May 3, 2017
1 parent
cfeb68c
commit 9032243
Showing
14 changed files
with
292 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
|
||
namespace Shoes.Migrations | ||
{ | ||
public partial class Initial : Migration | ||
{ | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Inventories", | ||
columns: table => new | ||
{ | ||
Id = table.Column<int>(nullable: false) | ||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), | ||
Revenue = table.Column<int>(nullable: false), | ||
Stock = table.Column<int>(nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Inventories", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Sales", | ||
columns: table => new | ||
{ | ||
SaleId = table.Column<int>(nullable: false) | ||
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), | ||
Comment = table.Column<string>(nullable: true), | ||
Image = table.Column<string>(nullable: true), | ||
InventoryId = table.Column<int>(nullable: true), | ||
Price = table.Column<int>(nullable: false), | ||
ShoeName = table.Column<string>(nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Sales", x => x.SaleId); | ||
table.ForeignKey( | ||
name: "FK_Sales_Inventories_InventoryId", | ||
column: x => x.InventoryId, | ||
principalTable: "Inventories", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Restrict); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Sales_InventoryId", | ||
table: "Sales", | ||
column: "InventoryId"); | ||
} | ||
|
||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Sales"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "Inventories"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
using Shoes.Models; | ||
|
||
namespace Shoes.Migrations | ||
{ | ||
[DbContext(typeof(ShoesDbContext))] | ||
partial class ShoesDbContextModelSnapshot : ModelSnapshot | ||
{ | ||
protected override void BuildModel(ModelBuilder modelBuilder) | ||
{ | ||
modelBuilder | ||
.HasAnnotation("ProductVersion", "1.0.0-rtm-21431") | ||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); | ||
|
||
modelBuilder.Entity("Shoes.Models.Inventory", b => | ||
{ | ||
b.Property<int>("Id") | ||
.ValueGeneratedOnAdd(); | ||
|
||
b.Property<int>("Revenue"); | ||
|
||
b.Property<int>("Stock"); | ||
|
||
b.HasKey("Id"); | ||
|
||
b.ToTable("Inventories"); | ||
}); | ||
|
||
modelBuilder.Entity("Shoes.Models.Sale", b => | ||
{ | ||
b.Property<int>("SaleId") | ||
.ValueGeneratedOnAdd(); | ||
|
||
b.Property<string>("Comment"); | ||
|
||
b.Property<string>("Image"); | ||
|
||
b.Property<int?>("InventoryId"); | ||
|
||
b.Property<int>("Price"); | ||
|
||
b.Property<string>("ShoeName"); | ||
|
||
b.HasKey("SaleId"); | ||
|
||
b.HasIndex("InventoryId"); | ||
|
||
b.ToTable("Sales"); | ||
}); | ||
|
||
modelBuilder.Entity("Shoes.Models.Sale", b => | ||
{ | ||
b.HasOne("Shoes.Models.Inventory", "Inventory") | ||
.WithMany("Sales") | ||
.HasForeignKey("InventoryId"); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
|
||
namespace Shoes.Models | ||
{ | ||
public class Inventory | ||
{ | ||
[Key] | ||
public int Id { get; set; } | ||
public int Stock { get; set; } | ||
public int Revenue { get; set; } | ||
public virtual ICollection<Sale> Sales { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace Shoes.Models | ||
{ | ||
public class Sale | ||
{ | ||
[Key] | ||
public int SaleId { get; set; } | ||
public string ShoeName { get; set; } | ||
public int Price { get; set; } | ||
public string Image { get; set; } | ||
public string Comment { get; set; } | ||
public virtual Inventory Inventory { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.EntityFrameworkCore; | ||
|
||
namespace Shoes.Models | ||
{ | ||
public class ShoesDbContext : DbContext | ||
{ | ||
public ShoesDbContext() | ||
{ | ||
|
||
} | ||
|
||
public DbSet<Inventory> Inventories { get; set; } | ||
public DbSet<Sale> Sales { get; set; } | ||
protected override void OnConfiguring(DbContextOptionsBuilder options) | ||
{ | ||
options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Shoes;integrated security=True"); | ||
} | ||
|
||
public ShoesDbContext(DbContextOptions<ShoesDbContext> options) | ||
: base(options) | ||
{ | ||
} | ||
|
||
protected override void OnModelCreating(ModelBuilder builder) | ||
{ | ||
base.OnModelCreating(builder); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"ConnectionStrings": { | ||
"DefaultConnection": "Server=(localdb)\\MSSQLLocalDB;Database=Shoes;Trusted_Connection=True;MultipleActiveResultSets=true" | ||
} | ||
} |
Binary file added
BIN
+260 KB
src/Shoes/bin/Debug/netcoreapp1.0/1a00a2b9-a4e5-40fa-ade6-efad28d9a3b3_Shoes.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"inputs":["C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\project.json","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\project.lock.json","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Program.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Startup.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Controllers\\HomeController.cs"],"outputs":["C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\bin\\Debug\\netcoreapp1.0\\Shoes.dll","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\bin\\Debug\\netcoreapp1.0\\Shoes.pdb","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\bin\\Debug\\netcoreapp1.0\\Shoes.deps.json","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\bin\\Debug\\netcoreapp1.0\\Shoes.runtimeconfig.json"],"buildArguments":{"version-suffix":null}} | ||
{"inputs":["C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\project.json","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\project.lock.json","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Program.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Startup.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Controllers\\HomeController.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Migrations\\20170503172321_Initial.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Migrations\\20170503172321_Initial.Designer.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Migrations\\ShoesDbContextModelSnapshot.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Models\\Inventory.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Models\\Sale.cs","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\Models\\ShoesDbContext.cs"],"outputs":["C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\bin\\Debug\\netcoreapp1.0\\Shoes.dll","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\bin\\Debug\\netcoreapp1.0\\Shoes.pdb","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\bin\\Debug\\netcoreapp1.0\\Shoes.deps.json","C:\\Users\\epicodus\\Desktop\\Shoes\\src\\Shoes\\bin\\Debug\\netcoreapp1.0\\Shoes.runtimeconfig.json"],"buildArguments":{"version-suffix":null}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters