public ItemCategoryDTO GetItemCategoryById(int itemId) { ItemCategoryDTO itemCategoryDTO = null; var itemCategory = unitOfWork.ItemRepository.GetById(itemId); if (itemCategory != null) { itemCategoryDTO = ItemConvertor.ConvertToItemCategoryDto(itemCategory); } return(itemCategoryDTO); }
public List <ItemCategoryDTO> GetAllItemCategory() { List <ItemCategoryDTO> itemCategoryList = new List <ItemCategoryDTO>(); var itemCategories = unitOfWork.ItemRepository.GetAll(); if (itemCategories != null) { foreach (var itemCategory in itemCategories) { itemCategoryList.Add(ItemConvertor.ConvertToItemCategoryDto(itemCategory)); } } return(itemCategoryList); }