public static CategoryDto ConvertToCategoryDto(Categories categories) { var categoryDto = new CategoryDto(); categoryDto.CategoryId = categories.CategoryId; categoryDto.name = categories.Name; categoryDto.StatusId = categories.Status.Id; return categoryDto; }
public static HotCategoryDto ConvertToHotCategoryDto(Categories category) { var hotCategoryDto = new HotCategoryDto(); hotCategoryDto.CategoryId = category.CategoryId; hotCategoryDto.Name = category.Name; List<Products> listProducts = null; if (ProductDAO.getAllProductByCategory(category.CategoryId) != null) listProducts = ProductDAO.getAllProductByCategory(category.CategoryId).ToList(); hotCategoryDto.Products = ConvertToListProductDto(listProducts); return hotCategoryDto; }