Spaces:
Sleeping
Sleeping
Download Repositories/StockRepository.cs from azizproject/Oilshop: direct link, hf CLI and curl.
- Browser
- Download file 775 Bytes
-
https://huggingface.co/spaces/azizproject/Oilshop/resolve/main/Repositories/StockRepository.cs
- Command line
-
hf download hf://spaces/azizproject/Oilshop/Repositories/StockRepository.cs
-
curl -L -o StockRepository.cs https://huggingface.co/spaces/azizproject/Oilshop/resolve/main/Repositories/StockRepository.cs
775 Bytes
| using Microsoft.EntityFrameworkCore; | |
| using OilShopManagement.Data; | |
| using OilShopManagement.Models; | |
| namespace OilShopManagement.Repositories; | |
| public class StockRepository : Repository<StockTransaction>, IStockRepository | |
| { | |
| public StockRepository(ApplicationDbContext context) : base(context) { } | |
| public async Task<IEnumerable<StockTransaction>> GetByProductAsync(int productId) => | |
| await _dbSet.Include(st => st.Product) | |
| .Where(st => st.ProductId == productId) | |
| .OrderByDescending(st => st.CreatedAt).ToListAsync(); | |
| public async Task<IEnumerable<StockTransaction>> GetRecentAsync(int count = 20) => | |
| await _dbSet.Include(st => st.Product) | |
| .OrderByDescending(st => st.CreatedAt).Take(count).ToListAsync(); | |
| } | |