public async Task <IActionResult> GetVendor(int id) { var vendor = await _repo.GetVendor(id); var vendorToReturn = _mapper.Map <VendorForDetailsDto>(vendor); return(Ok(vendorToReturn)); }
public async Task <IActionResult> GetProduct(int id) { var product = await _repo.GetProduct(id); var productToReturn = _mapper.Map <ProductForDetailsDto>(product); var vendor = await _repo.GetVendor(productToReturn.VendorId); productToReturn.VendorName = vendor.Name; return(Ok(productToReturn)); }