Skip to content

Commit da731f0

Browse files
committed
init2020
1 parent e1b8171 commit da731f0

14 files changed

Lines changed: 271 additions & 0 deletions

File tree

WebApiLab.BLL/DTOs/Category.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace WebApiLab.API.DTO
2+
{
3+
public class Category
4+
{
5+
public int Id { get; set; }
6+
public string Name { get; set; }
7+
}
8+
}

WebApiLab.BLL/DTOs/Order.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
3+
namespace WebApiLab.API.DTO
4+
{
5+
public class Order
6+
{
7+
public int Id { get; set; }
8+
public DateTime OrderDate { get; set; }
9+
}
10+
}

WebApiLab.BLL/DTOs/Product.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System.Collections.Generic;
2+
using WebApiLab.Entities;
3+
4+
namespace WebApiLab.API.DTO
5+
{
6+
public class Product
7+
{
8+
public int Id { get; set; }
9+
public string Name { get; set; }
10+
public int UnitPrice { get; set; }
11+
public ShipmentRegion ShipmentRegion { get; set; }
12+
public int CategoryId { get; set; }
13+
public Category Category { get; set; }
14+
public List<Order> Orders { get; set; }
15+
}
16+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
3+
namespace WebApiLab.BLL
4+
{
5+
public class EntityNotFoundException : Exception
6+
{
7+
public EntityNotFoundException()
8+
{
9+
}
10+
11+
public EntityNotFoundException(string message) : base(message)
12+
{
13+
}
14+
15+
public EntityNotFoundException(string message, Exception innerException) : base(message, innerException)
16+
{
17+
}
18+
}
19+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Collections.Generic;
2+
using WebApiLab.Entities;
3+
4+
namespace WebApiLab.BLL
5+
{
6+
interface IProductService
7+
{
8+
Product GetProduct(int productId);
9+
IEnumerable<Product> GetProducts();
10+
Product InsertProduct(Product newProduct);
11+
void UpdateProduct(int productId, Product updatedProduct);
12+
void DeleteProduct(int productId);
13+
}
14+
}

WebApiLab.BLL/WebApiLab.BLL.csproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<Folder Include="Exceptions\" />
9+
<Folder Include="DTOs\" />
10+
<Folder Include="Services\" />
11+
</ItemGroup>
12+
13+
<ItemGroup>
14+
<ProjectReference Include="..\WebApiLab.DAL\WebApiLab.DAL.csproj" />
15+
</ItemGroup>
16+
17+
</Project>

WebApiLab.DAL/Entities/Category.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using System.Collections.Generic;
2+
3+
namespace WebApiLab.Entities
4+
{
5+
public class Category
6+
{
7+
public int Id { get; set; }
8+
public string Name { get; set; }
9+
10+
public ICollection<Product> Products { get; } = new List<Product>();
11+
}
12+
}

WebApiLab.DAL/Entities/Order.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace WebApiLab.Entities
5+
{
6+
public class Order
7+
{
8+
public int Id { get; set; }
9+
public DateTime OrderDate { get; set; }
10+
11+
public ICollection<ProductOrder> ProductOrders { get; } = new List<ProductOrder>();
12+
}
13+
}

WebApiLab.DAL/Entities/Product.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Collections.Generic;
2+
3+
4+
namespace WebApiLab.Entities
5+
{
6+
public class Product
7+
{
8+
public int Id { get; set; }
9+
public string Name { get; set; }
10+
public int UnitPrice { get; set; }
11+
public ShipmentRegion ShipmentRegion { get; set; }
12+
13+
public int CategoryId { get; set; }
14+
public Category Category { get; set; }
15+
16+
public ICollection<ProductOrder> ProductOrders { get; } = new List<ProductOrder>();
17+
}
18+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace WebApiLab.Entities
2+
{
3+
public class ProductOrder
4+
{
5+
public int Id { get; set; }
6+
7+
public int ProductId { get; set; }
8+
public Product Product { get; set; }
9+
10+
public int OrderId { get; set; }
11+
public Order Order { get; set; }
12+
}
13+
}

0 commit comments

Comments
 (0)