Home > Mobile >  How to get category image by category id in nopcommerce
How to get category image by category id in nopcommerce

Time:09-21

how can I get category image by category id in nopcommerce?

I am working in CategoryNavigationModel page with @model CategoryNavigationModel Model.

CodePudding user response:

You need to pass category picture id. You can get category image by :

var picture = await _pictureService.GetPictureByIdAsync(category.PictureId);

CodePudding user response:

For getting all properties of category model using this method:

var category = await _categoryService.GetCategoryByIdAsync(id);

For getting a picture URL with target Size:

var PictureUrl = await _pictureService.GetPictureUrlAsync(category.PictureId, targetSize: 200);

For getting a full-size picture URL:

var FullPictureUrl = await _pictureService.GetPictureUrlAsync(category.PictureId);

For getting All properties of a picture as Picture Model:

var picture = await _pictureService.GetPictureByIdAsync(category.PictureId);
  • Related