commiting recent changes

This commit is contained in:
Aneliya Konarcheva
2021-03-07 13:53:10 +02:00
parent f8ee73f50b
commit ea95b4ad6b
11 changed files with 12 additions and 153 deletions

View File

@@ -4,4 +4,8 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Models\Models.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

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

View File

@@ -9,6 +9,8 @@ namespace LuminousSales.Data
{
}
public DbSet<Role> Roles { get; set; }
}
}

View File

@@ -6,6 +6,11 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.12" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.12">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>