Skip to content

Commit

Permalink
Shopping Card added to Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
aliarmaganuygun committed Oct 15, 2024
1 parent 35c6507 commit 776c56d
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using BookBazaar.Models;

namespace BookBazaar.DataAccess.Repository.IRepository
{
public interface IShoppingCardRepository : IRepository<ShoppingCart>
{
void Update(ShoppingCart obj);
}
}
3 changes: 2 additions & 1 deletion Bulky.DataAccess/Repository/IRepository/IUnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
public interface IUnitOfWork
{
ICategoryRepository Category { get; }
IProductRepository Product { get; }
ICompanyRepository Company { get; }
IProductRepository Product { get; }
IShoppingCardRepository ShoppingCart { get; }
void Save();
}
}
21 changes: 21 additions & 0 deletions Bulky.DataAccess/Repository/ShoppingCartRepository.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 ShoppingCartRepository : Repository<ShoppingCart>, IShoppingCardRepository
{
private readonly ApplicationDbContext _db;

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

public void Update(ShoppingCart obj)
{
_db.ShoppingCarts.Update(obj);
}
}
}
2 changes: 2 additions & 0 deletions Bulky.DataAccess/Repository/UnitOfWork.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ public class UnitOfWork : IUnitOfWork
public ICategoryRepository Category { get; private set; }
public ICompanyRepository Company { get; private set; }
public IProductRepository Product { get; private set; }
public IShoppingCardRepository ShoppingCart { get; private set; }
public UnitOfWork(ApplicationDbContext db)
{
_db = db;
Category = new CategoryRepository(_db);
Product = new ProductRepository(_db);
Company = new CompanyRepository(_db);
ShoppingCart = new ShoppingCartRepository(_db);
}

public void Save()
Expand Down

0 comments on commit 776c56d

Please sign in to comment.