At the moment it is possible to get all the products with an API call, i tried going into the uwebshop files, and inside the StoreApiController i created inside PublicApiController i created this
public IEnumerable<Category> GetAllCategories()
{
return DomainHelper.GetAllCategories().Cast<Category>();
}
But it gives me some problems when i try to access it.
Type 'uWebshop.Domain.Product' with data contract name 'Product:' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
Creating a GetAllCategories API
At the moment it is possible to get all the products with an API call, i tried going into the uwebshop files, and inside the StoreApiController i created inside PublicApiController i created this
But it gives me some problems when i try to access it.
Type 'uWebshop.Domain.Product' with data contract name 'Product:' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
Any help would be great!
I just ran into this problem now and thought I'd share how I got it working.
You need to add a reference to System.ServiceModel and put an attribute to your method, in this case like:
[ServiceKnownType(typeof(Category[]))]
is working on a reply...