public IDataResult <ProductDetailsDto> GetProductDetailsById(int productId) { var product = _productDao.Get(p => p.Id == productId); var productCategory = _categoryDao.Get(c => c.Id == product.CategoryId); var productDetailsDto = new ProductDetailsDto { ProductId = product.Id, ProductName = product.Name, ProductDescription = product.Description, ProductPrice = product.UnitPrice, ProductCost = product.UnitCost, ProductQuantity = product.UnitCount, }; if (productCategory != null) { productDetailsDto.CategoryId = productCategory.Id; productDetailsDto.CategoryName = productCategory.Name; } return(new SuccessDataResult <ProductDetailsDto>(productDetailsDto)); }
public Category GetCategory(int scope, string id) { return(categoryDao.Get(scope, id)); }