Skip to content

Commit

Permalink
Add Order Header and Order Detail Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
aliarmaganuygun committed Oct 19, 2024
1 parent 2567182 commit e869d0f
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using BookBazaar.Models;

namespace BookBazaar.DataAccess.Repository.IRepository
{
public interface IOrderDetailRepository : IRepository<OrderDetail>
{
void Update(OrderDetail obj);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using BookBazaar.Models;

namespace BookBazaar.DataAccess.Repository.IRepository
{
public interface IOrderHeaderRepository : IRepository<OrderHeader>
{
void Update(OrderHeader obj);
}
}
2 changes: 2 additions & 0 deletions Bulky.DataAccess/Repository/IRepository/IUnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ public interface IUnitOfWork
ICompanyRepository Company { get; }
IProductRepository Product { get; }
IShoppingCartRepository ShoppingCart { get; }
IOrderHeaderRepository OrderHeader { get; }
IOrderDetailRepository OrderDetail { get; }
void Save();
}
}
21 changes: 21 additions & 0 deletions Bulky.DataAccess/Repository/OrderDetailRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using BookBazaar.DataAccess.Data;
using BookBazaar.DataAccess.Repository.IRepository;
using BookBazaar.Models;

namespace BookBazaar.DataAccess.Repository
{
public class OrderDetailRepository : Repository<OrderDetail>, IOrderDetailRepository
{
private readonly ApplicationDbContext _db;

public OrderDetailRepository(ApplicationDbContext db) : base(db)
{
_db = db;
}

public void Update(OrderDetail obj)
{
_db.Update(obj);
}
}
}
21 changes: 21 additions & 0 deletions Bulky.DataAccess/Repository/OrderHeaderRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using BookBazaar.DataAccess.Data;
using BookBazaar.DataAccess.Repository.IRepository;
using BookBazaar.Models;

namespace BookBazaar.DataAccess.Repository
{
public class OrderHeaderRepository : Repository<OrderHeader>, IOrderHeaderRepository
{
private readonly ApplicationDbContext _db;

public OrderHeaderRepository(ApplicationDbContext db) : base(db)
{
_db = db;
}

public void Update(OrderHeader obj)
{
_db.Update(obj);
}
}
}
4 changes: 4 additions & 0 deletions Bulky.DataAccess/Repository/UnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class UnitOfWork : IUnitOfWork
public ICompanyRepository Company { get; private set; }
public IProductRepository Product { get; private set; }
public IShoppingCartRepository ShoppingCart { get; private set; }
public IOrderHeaderRepository OrderHeader { get; private set; }
public IOrderDetailRepository OrderDetail { get; private set; }
public UnitOfWork(ApplicationDbContext db)
{
_db = db;
Expand All @@ -19,6 +21,8 @@ public UnitOfWork(ApplicationDbContext db)
Product = new ProductRepository(_db);
Company = new CompanyRepository(_db);
ShoppingCart = new ShoppingCartRepository(_db);
OrderHeader = new OrderHeaderRepository(_db);
OrderDetail = new OrderDetailRepository(_db);
}

public void Save()
Expand Down

0 comments on commit e869d0f

Please sign in to comment.