EF Models created

This commit is contained in:
batgo6o
2021-03-11 01:47:22 +02:00
parent f8ee73f50b
commit b45909ab63
45 changed files with 704 additions and 519 deletions

View File

@@ -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>

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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();
}
}
}
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,14 @@
using Models;
namespace LuminousSales.Business
{
public class UsersController
{
private LuminousContext userContext;
public UsersController()
{
this.userContext = new LuminousContext();
}
}
}

View File

@@ -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;
}
}