DateTime replaced Timestamp, StockController methods
This commit is contained in:
@@ -8,7 +8,7 @@ namespace Business.Business.Sales
|
|||||||
{
|
{
|
||||||
ICollection<T> GetAll();
|
ICollection<T> GetAll();
|
||||||
T Get(int id);
|
T Get(int id);
|
||||||
ICollection<T> GetByTime(byte[] startPeriod, byte[] endPeriod);
|
ICollection<T> GetByTime(DateTime time);
|
||||||
void Add(int productId, double Amount);
|
void Add(int productId, double Amount);
|
||||||
void Add(string productName, double Amount);
|
void Add(string productName, double Amount);
|
||||||
void Delete(int id);
|
void Delete(int id);
|
||||||
|
@@ -8,11 +8,30 @@ using Models.Models;
|
|||||||
|
|
||||||
namespace Business.Business.Sales
|
namespace Business.Business.Sales
|
||||||
{
|
{
|
||||||
public class StockController : IStockController<Product>
|
public class StockController : ISalesController<Product>
|
||||||
{
|
{
|
||||||
private LuminousContext context;
|
private LuminousContext context;
|
||||||
|
|
||||||
|
Product ISalesController<Product>.Get(int id)
|
||||||
|
{
|
||||||
|
return context.Product.Find(id);
|
||||||
|
}
|
||||||
|
ICollection<Product> ISalesController<Product>.GetByTime(DateTime time)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
void ISalesController<Product>.Add(int productId, double Amount)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
void ISalesController<Product>.Add(string productName, double Amount)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
void ISalesController<Product>.Delete(int id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
public ICollection<Product> GetAll()
|
public ICollection<Product> GetAll()
|
||||||
{
|
{
|
||||||
using (context = new LuminousContext())
|
using (context = new LuminousContext())
|
||||||
@@ -21,15 +40,6 @@ namespace Business.Business.Sales
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Product GetById(int id)
|
|
||||||
{
|
|
||||||
using (context = new LuminousContext())
|
|
||||||
{
|
|
||||||
return context.Product.Find(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddProduct(Product product)
|
public void AddProduct(Product product)
|
||||||
{
|
{
|
||||||
using (context = new LuminousContext())
|
using (context = new LuminousContext())
|
||||||
@@ -41,8 +51,7 @@ namespace Business.Business.Sales
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public void LoadProduct(int id)
|
||||||
public void LoadProductById(int id)
|
|
||||||
{
|
{
|
||||||
using (context = new LuminousContext())
|
using (context = new LuminousContext())
|
||||||
{
|
{
|
||||||
@@ -55,7 +64,7 @@ namespace Business.Business.Sales
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadProductByName(Product product)
|
public void LoadProduct(Product product)
|
||||||
{
|
{
|
||||||
using (context = new LuminousContext())
|
using (context = new LuminousContext())
|
||||||
{
|
{
|
||||||
@@ -93,11 +102,6 @@ namespace Business.Business.Sales
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Product GetByName(string name)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,13 @@
|
|||||||
<TargetFramework>netstandard2.1</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Remove="Migrations\20210318105825_init.cs" />
|
||||||
|
<Compile Remove="Migrations\20210318105825_init.Designer.cs" />
|
||||||
|
<Compile Remove="Migrations\20210318192056_DateTimeUpdate.cs" />
|
||||||
|
<Compile Remove="Migrations\20210318192056_DateTimeUpdate.Designer.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.12" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.12" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.12">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.12">
|
||||||
@@ -18,4 +25,8 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Migrations\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@@ -10,7 +10,7 @@ using Models;
|
|||||||
namespace Data.Migrations
|
namespace Data.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(LuminousContext))]
|
[DbContext(typeof(LuminousContext))]
|
||||||
[Migration("20210318105825_init")]
|
[Migration("20210318193112_init")]
|
||||||
partial class init
|
partial class init
|
||||||
{
|
{
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -34,11 +34,8 @@ namespace Data.Migrations
|
|||||||
b.Property<int>("ProductId")
|
b.Property<int>("ProductId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<byte[]>("Time")
|
b.Property<DateTime>("Time")
|
||||||
.IsConcurrencyToken()
|
.HasColumnType("datetime2");
|
||||||
.IsRequired()
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("rowversion");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
b.Property<int>("UserId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
@@ -109,11 +106,8 @@ namespace Data.Migrations
|
|||||||
b.Property<int>("ProductId")
|
b.Property<int>("ProductId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<byte[]>("Time")
|
b.Property<DateTime>("Time")
|
||||||
.IsConcurrencyToken()
|
.HasColumnType("datetime2");
|
||||||
.IsRequired()
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("rowversion");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
b.Property<int>("UserId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
@@ -65,7 +65,7 @@ namespace Data.Migrations
|
|||||||
UserId = table.Column<int>(nullable: false),
|
UserId = table.Column<int>(nullable: false),
|
||||||
ProductId = table.Column<int>(nullable: false),
|
ProductId = table.Column<int>(nullable: false),
|
||||||
Amount = table.Column<double>(nullable: false),
|
Amount = table.Column<double>(nullable: false),
|
||||||
Time = table.Column<byte[]>(rowVersion: true, nullable: false)
|
Time = table.Column<DateTime>(nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -93,7 +93,7 @@ namespace Data.Migrations
|
|||||||
UserId = table.Column<int>(nullable: false),
|
UserId = table.Column<int>(nullable: false),
|
||||||
ProductId = table.Column<int>(nullable: false),
|
ProductId = table.Column<int>(nullable: false),
|
||||||
Amount = table.Column<double>(nullable: false),
|
Amount = table.Column<double>(nullable: false),
|
||||||
Time = table.Column<byte[]>(rowVersion: true, nullable: false)
|
Time = table.Column<DateTime>(nullable: false)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
@@ -32,11 +32,8 @@ namespace Data.Migrations
|
|||||||
b.Property<int>("ProductId")
|
b.Property<int>("ProductId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<byte[]>("Time")
|
b.Property<DateTime>("Time")
|
||||||
.IsConcurrencyToken()
|
.HasColumnType("datetime2");
|
||||||
.IsRequired()
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("rowversion");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
b.Property<int>("UserId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
@@ -107,11 +104,8 @@ namespace Data.Migrations
|
|||||||
b.Property<int>("ProductId")
|
b.Property<int>("ProductId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<byte[]>("Time")
|
b.Property<DateTime>("Time")
|
||||||
.IsConcurrencyToken()
|
.HasColumnType("datetime2");
|
||||||
.IsRequired()
|
|
||||||
.ValueGeneratedOnAddOrUpdate()
|
|
||||||
.HasColumnType("rowversion");
|
|
||||||
|
|
||||||
b.Property<int>("UserId")
|
b.Property<int>("UserId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
@@ -33,8 +33,8 @@ namespace Data.Base
|
|||||||
public virtual Product Products { get; set; }
|
public virtual Product Products { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public double Amount { get; set; }
|
public double Amount { get; set; }
|
||||||
[Timestamp]
|
// [DataType(DataType.DateTime)]
|
||||||
[Required]
|
[Required]
|
||||||
public byte[] Time { get; set; }
|
public DateTime Time { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user