@@ -82,7 +82,7 @@ public async Task<PagedDto<PlatformViewDto>> GetPlatforms(int pageSize, int page
82
82
{
83
83
var errors = new Dictionary < string , List < string > > ( ) ;
84
84
85
- await ValidatePlatformCreateDto ( dto , errors ) ;
85
+ await ValidatePlatformCreateDto < PlatformCreateDto > ( dto , errors ) ;
86
86
87
87
if ( errors . Any ( ) )
88
88
{
@@ -93,12 +93,13 @@ public async Task<PagedDto<PlatformViewDto>> GetPlatforms(int pageSize, int page
93
93
94
94
_unitOfWork . Commit ( ) ;
95
95
96
- return ( errors , entity . OrganizationId ) ;
96
+ return ( errors , entity . OrganizationId ) ;
97
97
}
98
98
99
- private async Task < Dictionary < string , List < string > > > ValidatePlatformCreateDto ( IPlatformCreateDto dto , Dictionary < string , List < string > > errors )
99
+ private async Task < Dictionary < string , List < string > > > ValidatePlatformCreateDto < T > ( IPlatformCreateDto dto , Dictionary < string , List < string > > errors )
100
+ where T : class , IPlatformCreateDto
100
101
{
101
- _validator . Validate ( Entities . Platform , dto , errors ) ;
102
+ _validator . Validate ( Entities . Platform , ( T ) dto , errors ) ;
102
103
103
104
if ( errors . Any ( ) )
104
105
{
@@ -117,7 +118,7 @@ public async Task<Dictionary<string, List<string>>> UpdatePlatformAsync(Platform
117
118
{
118
119
var errors = new Dictionary < string , List < string > > ( ) ;
119
120
120
- await ValidatePlatformUpdateDto ( dto , errors ) ;
121
+ await ValidatePlatformUpdateDto < PlatformUpdateDto > ( dto , errors ) ;
121
122
122
123
if ( errors . Any ( ) )
123
124
{
@@ -131,7 +132,8 @@ public async Task<Dictionary<string, List<string>>> UpdatePlatformAsync(Platform
131
132
return errors ;
132
133
}
133
134
134
- private async Task < Dictionary < string , List < string > > > ValidatePlatformUpdateDto ( IPlatformUpdateDto dto , Dictionary < string , List < string > > errors )
135
+ private async Task < Dictionary < string , List < string > > > ValidatePlatformUpdateDto < T > ( IPlatformUpdateDto dto , Dictionary < string , List < string > > errors )
136
+ where T : class , IPlatformUpdateDto
135
137
{
136
138
var platformDto = await _orgRepo . GetPlatform ( dto . OrganizationId ) ;
137
139
@@ -141,7 +143,7 @@ private async Task<Dictionary<string, List<string>>> ValidatePlatformUpdateDto(I
141
143
return errors ;
142
144
}
143
145
144
- _validator . Validate ( Entities . Platform , dto , errors ) ;
146
+ _validator . Validate ( Entities . Platform , ( T ) dto , errors ) ;
145
147
146
148
return errors ;
147
149
}
@@ -157,7 +159,7 @@ private async Task<Dictionary<string, List<string>>> ValidatePlatformUpdateDto(I
157
159
return ( errors , 0 ) ;
158
160
}
159
161
160
- await ValidatePlatformCreateDto ( dto , errors ) ;
162
+ await ValidatePlatformCreateDto < PlatformCreateDto > ( dto , errors ) ;
161
163
162
164
if ( errors . Any ( ) )
163
165
{
@@ -205,7 +207,7 @@ public async Task<Dictionary<string, List<string>>> UpdatePlatformSubAsync(Platf
205
207
return errors ;
206
208
}
207
209
208
- await ValidatePlatformUpdateDto ( dto , errors ) ;
210
+ await ValidatePlatformUpdateDto < PlatformSubUpdateDto > ( dto , errors ) ;
209
211
210
212
if ( errors . Any ( ) )
211
213
{
0 commit comments