Why Nop.Web Model is null?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago

In my picture u will see AllCategoryController which is my Plugins Controller and CategoryModel is from Nop.Web,but there is a problem and Problem is that model is null.Can u explain me why it is null?
This is CategoryModel
5 years ago
Hi,

the model is null because you are just creating an instance of it ( without populating any data to it ). You need to either use the CatalogModelFactory to populate the data of the category model or you can do it manually e.g. model.Name = category.Name;

Regards,
Hristian
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.