commit new library
This commit is contained in:
7
LuminousSales/Business/Business.csproj
Normal file
7
LuminousSales/Business/Business.csproj
Normal file
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
13
LuminousSales/Business/Business/DealsBusiness.cs
Normal file
13
LuminousSales/Business/Business/DealsBusiness.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class DealsBusiness
|
||||
{
|
||||
private DealContext dealContext;
|
||||
|
||||
}
|
||||
}
|
12
LuminousSales/Business/Business/PermissionsBusiness.cs
Normal file
12
LuminousSales/Business/Business/PermissionsBusiness.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class PermissionsBusiness
|
||||
{
|
||||
private PermissionContext permissionContext;
|
||||
}
|
||||
}
|
66
LuminousSales/Business/Business/ProductBusiness.cs
Normal file
66
LuminousSales/Business/Business/ProductBusiness.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
12
LuminousSales/Business/Business/RolesBusiness.cs
Normal file
12
LuminousSales/Business/Business/RolesBusiness.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class RolesBusiness
|
||||
{
|
||||
private RoleContext roleContext;
|
||||
}
|
||||
}
|
13
LuminousSales/Business/Business/RolesToPermissionBusiness.cs
Normal file
13
LuminousSales/Business/Business/RolesToPermissionBusiness.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class RolesToPermissionBusiness
|
||||
{
|
||||
private RolesToPermissionContext rolesToPermissionContext;
|
||||
|
||||
}
|
||||
}
|
12
LuminousSales/Business/Business/StocksBusiness.cs
Normal file
12
LuminousSales/Business/Business/StocksBusiness.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class StocksBusiness
|
||||
{
|
||||
private StockContext stockContext;
|
||||
}
|
||||
}
|
12
LuminousSales/Business/Business/UsersBusiness.cs
Normal file
12
LuminousSales/Business/Business/UsersBusiness.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using LuminousSales.Data;
|
||||
|
||||
namespace LuminousSales.Business
|
||||
{
|
||||
public class UsersBusiness
|
||||
{
|
||||
private UserContext userContext;
|
||||
}
|
||||
}
|
12
LuminousSales/Business/Business/UsersToRolesBusiness.cs
Normal file
12
LuminousSales/Business/Business/UsersToRolesBusiness.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
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