public HttpResponseMessage GetAllProductCategories() { var countries = productCategoryRepository.GetAllProductCategories(); var formatter = RequestFormat.JsonFormaterString(); return(Request.CreateResponse(HttpStatusCode.OK, countries, formatter)); }
/// <summary> /// Gets all categories. /// </summary> /// <returns></returns> /// <exception cref="NotImplementedException"></exception> public async Task <List <ProductCategoryDto> > GetAllCategories() { var categories = await _productCategoryRepository.GetAllProductCategories(); var categoriesDtos = _mapper.Map <List <ProductCategory>, List <ProductCategoryDto> >(categories); return(categoriesDtos); }
public IActionResult CreateProduct() { var productCategoriesList = productCategoryRepository.GetAllProductCategories(); var model = new CreateProductViewModel() { ProductCategorySelectList = new SelectList(productCategoriesList, "Id", "Name") }; return(View(model)); }