-
-
Save dcomartin/25bdff853318b14ccfbf5e4005f7c9e6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ShoppingCartDomainRepository | |
{ | |
private readonly SalesDbContext _dbContext; | |
public ShoppingCartDomainRepository(SalesDbContext dbContext) | |
{ | |
_dbContext = dbContext; | |
} | |
public async Task<ShoppingCartDomain> GetShoppingCart(Guid shoppingCartId) | |
{ | |
var data = await _dbContext.ShoppingCarts | |
.Include(x => x.Items) | |
.SingleAsync(x => x.ShoppingCartId == shoppingCartId); | |
return new ShoppingCartDomain(data); | |
} | |
public async Task Save() | |
{ | |
await _dbContext.SaveChangesAsync(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment