commit new library
This commit is contained in:
1 parent
76f84a6afa
commit
f8ee73f50b
20 files changed
+170
-23
No files matched your search
@@ -0,0 +1,7 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -5,7 +5,9 @@ VisualStudioVersion = 16.0.31019.35
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LuminousSales", "LuminousSales\LuminousSales.csproj", "{0B102226-3EAB-4DA3-9C1F-4053E4FA2232}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LuminousSales", "LuminousSales\LuminousSales.csproj", "{0B102226-3EAB-4DA3-9C1F-4053E4FA2232}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models", "Models\Models.csproj", "{40C482BF-B9C4-4460-BB1C-5A90959D1838}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Models", "Models\Models.csproj", "{40C482BF-B9C4-4460-BB1C-5A90959D1838}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Business", "Business\Business.csproj", "{E1661853-3081-4C40-8E68-C063B3BC88A4}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@@ -21,6 +23,10 @@ Global
|
|||||||
{40C482BF-B9C4-4460-BB1C-5A90959D1838}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{40C482BF-B9C4-4460-BB1C-5A90959D1838}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{40C482BF-B9C4-4460-BB1C-5A90959D1838}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{40C482BF-B9C4-4460-BB1C-5A90959D1838}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{40C482BF-B9C4-4460-BB1C-5A90959D1838}.Release|Any CPU.Build.0 = Release|Any CPU
|
{40C482BF-B9C4-4460-BB1C-5A90959D1838}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{E1661853-3081-4C40-8E68-C063B3BC88A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E1661853-3081-4C40-8E68-C063B3BC88A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E1661853-3081-4C40-8E68-C063B3BC88A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E1661853-3081-4C40-8E68-C063B3BC88A4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace LuminousSales.Data.Model
|
|
||||||
{
|
|
||||||
public class Product
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string Name { get; set; }
|
|
||||||
public decimal Price { get; set; }
|
|
||||||
public int AmountInStock { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +1,14 @@
|
|||||||
using System;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Data.Entity;
|
|
||||||
using System.Text;
|
|
||||||
using LuminousSales.Data.Model;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace LuminousSales.Data
|
namespace LuminousSales.Data
|
||||||
{
|
{
|
||||||
public class ProductContext : DbContext
|
public class ProductContext : DbContext
|
||||||
{
|
{
|
||||||
public ProductContext():base("name = ProductContext")
|
public ProductContext():base()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
public DbSet<Product> Products { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user