public SumResultModel <ProductListDto> GetProductList(Expression <Func <Products, bool> > filter = null, DataPagingOptions dataPagingOptions = null)
        {
            SumResultModel <ProductListDto> result = new SumResultModel <ProductListDto>();

            var list = _repository.Get(filter, dataPagingOptions).Select(c => new ProductListDto
            {
                ProductId       = c.ProductId,
                CategoryName    = c.CategoryId != null ? _baseCrudCategoryRepository.GetById((int)c.CategoryId).CategoryName : string.Empty,
                ProductName     = c.ProductName,
                QuantityPerUnit = c.QuantityPerUnit,
                SupplierName    = c.SupplierId != null ? _baseCrudSupplierRepository.GetById((int)c.SupplierId).CompanyName : string.Empty,
                UnitPrice       = c.UnitPrice,
                UnitsInStock    = c.UnitsInStock
            }).ToList();

            result.Data             = list;
            result.Success          = true;
            result.StatusCode       = 200;
            result.TotalRecordCount = _repository.GetTotalRecordCount();

            return(result);
        }
Exemple #2
0
 public T GetById(IdType id)
 {
     return(_repository.GetById(id));
 }
Exemple #3
0
 public TDto GetById(int id)
 {
     return(baseCrudRepository.GetById(id));
 }