Code Clarification #392
Replies: 1 comment 2 replies
-
Hi @AERONAUT-AUT,
To get only the name of the brand table you could make a new endpoint in the API controller and create a new command and so on... Then when you can dd in the repository a method that only returns the all the names or use the getall and only use the name property. In the response you can only return a list of all the names of the brands. If you want to see how to add everything in the correct order, take a look at this discussion where there is a list with all the steps. |
Beta Was this translation helpful? Give feedback.
-
I´m a complete newcomer and trying to get all the Stuff together.
Could you please explain below mentioned Codelines ( of the BlazorHero Template) to me!?
what is the purpose of the:
*) await _cache.GetorAddAsync
*) _mapper.map
lines?
Furthermore i´m trying to get only the Name Column of the Brands Table, but can´t figure out a way.
public async Task<Result<List<GetAllBrandsResponse>>> Handle(GetAllBrandsQuery request, CancellationToken cancellationToken) { Func<Task<List<Brand>>> getAllBrands = () => _unitOfWork.Repository<Brand>().GetAllAsync(); var brandList = await _cache.GetOrAddAsync(ApplicationConstants.Cache.GetAllBrandsCacheKey, getAllBrands); var mappedBrands = _mapper.Map<List<GetAllBrandsResponse>>(brandList); return await Result<List<GetAllBrandsResponse>>.SuccessAsync(mappedBrands); }
Can you help me please?
Beta Was this translation helpful? Give feedback.
All reactions