Initial git push
This commit is contained in:
30
H_PLUS_Sports/Models/Customer.cs
Normal file
30
H_PLUS_Sports/Models/Customer.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace H_PLUS_Sports.Models
|
||||
{
|
||||
public partial class Customer
|
||||
{
|
||||
public Customer()
|
||||
{
|
||||
Order = new HashSet<Order>();
|
||||
}
|
||||
|
||||
public int CustomerId { get; set; }
|
||||
[StringLength(50)]
|
||||
public string FirstName { get; set; }
|
||||
[StringLength(50)]
|
||||
public string LastName { get; set; }
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
[Phone]
|
||||
public string Phone { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string City { get; set; }
|
||||
public string State { get; set; }
|
||||
public string Zipcode { get; set; }
|
||||
|
||||
public virtual ICollection<Order> Order { get; set; }
|
||||
}
|
||||
}
|
||||
180
H_PLUS_Sports/Models/H_Plus_SportsContext.cs
Normal file
180
H_PLUS_Sports/Models/H_Plus_SportsContext.cs
Normal file
@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
|
||||
namespace H_PLUS_Sports.Models
|
||||
{
|
||||
public partial class H_Plus_SportsContext : DbContext
|
||||
{
|
||||
public H_Plus_SportsContext()
|
||||
{
|
||||
}
|
||||
|
||||
public H_Plus_SportsContext(DbContextOptions<H_Plus_SportsContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<Customer> Customer { get; set; }
|
||||
public virtual DbSet<Order> Order { get; set; }
|
||||
public virtual DbSet<OrderItem> OrderItem { get; set; }
|
||||
public virtual DbSet<Product> Product { get; set; }
|
||||
public virtual DbSet<Salesperson> Salesperson { get; set; }
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<Customer>(entity =>
|
||||
{
|
||||
entity.Property(e => e.CustomerId).HasColumnName("CustomerID");
|
||||
|
||||
entity.Property(e => e.Address)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.City)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.FirstName)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.LastName)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.Phone)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.State)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.Zipcode)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Order>(entity =>
|
||||
{
|
||||
entity.Property(e => e.OrderId).HasColumnName("OrderID");
|
||||
|
||||
entity.Property(e => e.CustomerId).HasColumnName("CustomerID");
|
||||
|
||||
entity.Property(e => e.Date).HasColumnType("datetime");
|
||||
|
||||
entity.Property(e => e.SalespersonId).HasColumnName("SalespersonID");
|
||||
|
||||
entity.Property(e => e.Status)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.TotalDue).HasColumnType("money");
|
||||
|
||||
entity.HasOne(d => d.Customer)
|
||||
.WithMany(p => p.Order)
|
||||
.HasForeignKey(d => d.CustomerId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Order_Customer");
|
||||
|
||||
entity.HasOne(d => d.Salesperson)
|
||||
.WithMany(p => p.Order)
|
||||
.HasForeignKey(d => d.SalespersonId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_Order_Salesperson");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<OrderItem>(entity =>
|
||||
{
|
||||
entity.Property(e => e.OrderItemId).HasColumnName("OrderItemID");
|
||||
|
||||
entity.Property(e => e.OrderId).HasColumnName("OrderID");
|
||||
|
||||
entity.Property(e => e.ProductId)
|
||||
.IsRequired()
|
||||
.HasColumnName("ProductID")
|
||||
.HasMaxLength(10);
|
||||
|
||||
entity.HasOne(d => d.Order)
|
||||
.WithMany(p => p.OrderItem)
|
||||
.HasForeignKey(d => d.OrderId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_OrderItem_Order");
|
||||
|
||||
entity.HasOne(d => d.Product)
|
||||
.WithMany(p => p.OrderItem)
|
||||
.HasForeignKey(d => d.ProductId)
|
||||
.OnDelete(DeleteBehavior.ClientSetNull)
|
||||
.HasConstraintName("FK_OrderItem_Product1");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Product>(entity =>
|
||||
{
|
||||
entity.Property(e => e.ProductId)
|
||||
.HasColumnName("ProductID")
|
||||
.HasMaxLength(10);
|
||||
|
||||
entity.Property(e => e.Price).HasColumnType("money");
|
||||
|
||||
entity.Property(e => e.ProductName)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.Status)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.Variety)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Salesperson>(entity =>
|
||||
{
|
||||
entity.Property(e => e.SalespersonId).HasColumnName("SalespersonID");
|
||||
|
||||
entity.Property(e => e.Address)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.City)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.Email)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.FirstName)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.LastName)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.Phone)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.State)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
|
||||
entity.Property(e => e.Zipcode)
|
||||
.HasMaxLength(50)
|
||||
.IsUnicode(false);
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
}
|
||||
28
H_PLUS_Sports/Models/Order.cs
Normal file
28
H_PLUS_Sports/Models/Order.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace H_PLUS_Sports.Models
|
||||
{
|
||||
public partial class Order
|
||||
{
|
||||
public Order()
|
||||
{
|
||||
OrderItem = new HashSet<OrderItem>();
|
||||
}
|
||||
|
||||
public int OrderId { get; set; }
|
||||
[Required]
|
||||
[DataType(DataType.Date)]
|
||||
public DateTime? Date { get; set; }
|
||||
[Required]
|
||||
public decimal? TotalDue { get; set; }
|
||||
public string Status { get; set; }
|
||||
public int CustomerId { get; set; }
|
||||
public int SalespersonId { get; set; }
|
||||
|
||||
public virtual Customer Customer { get; set; }
|
||||
public virtual Salesperson Salesperson { get; set; }
|
||||
public virtual ICollection<OrderItem> OrderItem { get; set; }
|
||||
}
|
||||
}
|
||||
16
H_PLUS_Sports/Models/OrderItem.cs
Normal file
16
H_PLUS_Sports/Models/OrderItem.cs
Normal file
@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace H_PLUS_Sports.Models
|
||||
{
|
||||
public partial class OrderItem
|
||||
{
|
||||
public int OrderItemId { get; set; }
|
||||
public int OrderId { get; set; }
|
||||
public string ProductId { get; set; }
|
||||
public int? Quantity { get; set; }
|
||||
|
||||
public virtual Order Order { get; set; }
|
||||
public virtual Product Product { get; set; }
|
||||
}
|
||||
}
|
||||
22
H_PLUS_Sports/Models/Product.cs
Normal file
22
H_PLUS_Sports/Models/Product.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace H_PLUS_Sports.Models
|
||||
{
|
||||
public partial class Product
|
||||
{
|
||||
public Product()
|
||||
{
|
||||
OrderItem = new HashSet<OrderItem>();
|
||||
}
|
||||
|
||||
public string ProductId { get; set; }
|
||||
public string ProductName { get; set; }
|
||||
public int? Size { get; set; }
|
||||
public string Variety { get; set; }
|
||||
public decimal? Price { get; set; }
|
||||
public string Status { get; set; }
|
||||
|
||||
public virtual ICollection<OrderItem> OrderItem { get; set; }
|
||||
}
|
||||
}
|
||||
25
H_PLUS_Sports/Models/Salesperson.cs
Normal file
25
H_PLUS_Sports/Models/Salesperson.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace H_PLUS_Sports.Models
|
||||
{
|
||||
public partial class Salesperson
|
||||
{
|
||||
public Salesperson()
|
||||
{
|
||||
Order = new HashSet<Order>();
|
||||
}
|
||||
|
||||
public int SalespersonId { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Phone { get; set; }
|
||||
public string Address { get; set; }
|
||||
public string City { get; set; }
|
||||
public string State { get; set; }
|
||||
public string Zipcode { get; set; }
|
||||
|
||||
public virtual ICollection<Order> Order { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user