EF Models created
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.12" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Models\Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class DealsBusiness
|
||||
{
|
||||
private DealContext dealContext;
|
||||
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class PermissionsBusiness
|
||||
{
|
||||
private PermissionContext permissionContext;
|
||||
}
|
||||
}
|
@@ -1,66 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
using LuminousSales.Data.Model;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class ProductBusiness
|
||||
{
|
||||
private ProductContext productContext;
|
||||
|
||||
public List<Product> GetAll()
|
||||
{
|
||||
using (productContext = new ProductContext())
|
||||
{
|
||||
return productContext.Products.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public Product Get(int id)
|
||||
{
|
||||
using (productContext = new ProductContext())
|
||||
{
|
||||
return productContext.Products.Find(id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Buy(Product product)
|
||||
{
|
||||
using (productContext = new ProductContext())
|
||||
{
|
||||
productContext.Products.Add(product);
|
||||
productContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void Update(Product product)
|
||||
{
|
||||
using (productContext = new ProductContext())
|
||||
{
|
||||
var item = productContext.Products.Find(product.Id);
|
||||
if (item != null)
|
||||
{
|
||||
productContext.Entry(item).CurrentValues.SetValues(product);
|
||||
productContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Sell(int id)
|
||||
{
|
||||
using (productContext = new ProductContext())
|
||||
{
|
||||
var product = productContext.Products.Find(id);
|
||||
if (product != null)
|
||||
{
|
||||
productContext.Products.Remove(product);
|
||||
productContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class RolesBusiness
|
||||
{
|
||||
private RoleContext roleContext;
|
||||
}
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class RolesToPermissionBusiness
|
||||
{
|
||||
private RolesToPermissionContext rolesToPermissionContext;
|
||||
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class StocksBusiness
|
||||
{
|
||||
private StockContext stockContext;
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class UsersBusiness
|
||||
{
|
||||
private UserContext userContext;
|
||||
}
|
||||
}
|
14
LuminousSales/Business/Business/UsersController.cs
Normal file
14
LuminousSales/Business/Business/UsersController.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using Models;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class UsersController
|
||||
{
|
||||
private LuminousContext userContext;
|
||||
|
||||
public UsersController()
|
||||
{
|
||||
this.userContext = new LuminousContext();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class UsersToRolesBusiness
|
||||
{
|
||||
private UsersToRolesContext usersToRolesContext;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user