I have recently started using the ASP.NET Zero system and noticed that when I'm attempting to change an edition to a paid edition, it does not show it when I go to edit the edition again. In my database, I have the other values that I entered so the edition is saving correctly. When editing the edition, the radio button will still say "Free."
I noticed that the EditionAppService.cs file utilizes the ObjectMapper
to map from SubscribableEditions
to EditionEditDto
. When the SubscribableEdition
enters the mapper, it has the values for Monthly
and Annual
prices. When it exits the mapper as the EditionEditDto
, both values are null
. Somehow, the ObjectMapper
isn't pulling over these values.
I have attached two pictures below. The first shows the SubscribableEdition
that has the AnnualPrice
and the MonthlyPrice
.
When I take the next step in the second picture to see the results of the ObjectMapper
, you will see that it no longer has a value for either of those fields in the EditionEditDto
.
This results in the edition appearing to be Free when editing it. I thought that maybe the fact that it was a nullable Decimal
was the problem. But once I removed that and converted it to a normal decimal, it filled in the prices with zeroes instead of null
values. When I downloaded and completed the PhoneBook tutorial, I noticed that project also had the same issue of the Edition
not saving.
I am trying to figure out why the mapper isn't mapping the values over to the EditionEditDto
correctly.
It's due to a missing map in CustomDtoMapper.cs that will be added in v5.1:
- configuration.CreateMap<EditionEditDto, SubscribableEdition>();
+ configuration.CreateMap<EditionEditDto, SubscribableEdition>().ReverseMap();