@@ -29,6 +29,8 @@ public interface IOrganizationRepository
29
29
Task < DssOrganization > CreatePlatformAsync ( PlatformCreateDto dto ) ;
30
30
Task < bool > DoesOrgCdExist ( string orgCd ) ;
31
31
Task UpdatePlatformAsync ( PlatformUpdateDto dto ) ;
32
+ Task < DssOrganization > CreatePlatformSubAsync ( PlatformSubCreateDto dto ) ;
33
+ Task UpdatePlatformSubAsync ( PlatformSubUpdateDto dto ) ;
32
34
}
33
35
public class OrganizationRepository : RepositoryBase < DssOrganization > , IOrganizationRepository
34
36
{
@@ -188,10 +190,10 @@ public async Task<DssOrganization> CreatePlatformAsync(PlatformCreateDto dto)
188
190
189
191
await _dbSet . AddAsync ( entity ) ;
190
192
191
- CreateContact ( entity , EmailMessageTypes . NoticeOfTakedown , dto . NoticeOfTakedownContactEmail1 , true ) ;
192
- CreateContact ( entity , EmailMessageTypes . NoticeOfTakedown , dto . NoticeOfTakedownContactEmail2 , false ) ;
193
- CreateContact ( entity , EmailMessageTypes . TakedownRequest , dto . TakedownRequestContactEmail1 , true ) ;
194
- CreateContact ( entity , EmailMessageTypes . TakedownRequest , dto . TakedownRequestContactEmail2 , false ) ;
193
+ CreateContact ( entity , EmailMessageTypes . NoticeOfTakedown , dto . PrimaryNoticeOfTakedownContactEmail , true ) ;
194
+ CreateContact ( entity , EmailMessageTypes . NoticeOfTakedown , dto . SecondaryNoticeOfTakedownContactEmail , false ) ;
195
+ CreateContact ( entity , EmailMessageTypes . TakedownRequest , dto . PrimaryTakedownRequestContactEmail , true ) ;
196
+ CreateContact ( entity , EmailMessageTypes . TakedownRequest , dto . SecondaryTakedownRequestContactEmail , false ) ;
195
197
196
198
return entity ;
197
199
}
@@ -222,10 +224,10 @@ public async Task UpdatePlatformAsync(PlatformUpdateDto dto)
222
224
223
225
_mapper . Map ( dto , entity ) ;
224
226
225
- UpdateContact ( entity , EmailMessageTypes . NoticeOfTakedown , dto . NoticeOfTakedownContactEmail1 , true ) ;
226
- UpdateContact ( entity , EmailMessageTypes . NoticeOfTakedown , dto . NoticeOfTakedownContactEmail2 , false ) ;
227
- UpdateContact ( entity , EmailMessageTypes . TakedownRequest , dto . TakedownRequestContactEmail1 , true ) ;
228
- UpdateContact ( entity , EmailMessageTypes . TakedownRequest , dto . TakedownRequestContactEmail2 , false ) ;
227
+ UpdateContact ( entity , EmailMessageTypes . NoticeOfTakedown , dto . PrimaryNoticeOfTakedownContactEmail , true ) ;
228
+ UpdateContact ( entity , EmailMessageTypes . NoticeOfTakedown , dto . SecondaryNoticeOfTakedownContactEmail , false ) ;
229
+ UpdateContact ( entity , EmailMessageTypes . TakedownRequest , dto . PrimaryTakedownRequestContactEmail , true ) ;
230
+ UpdateContact ( entity , EmailMessageTypes . TakedownRequest , dto . SecondaryTakedownRequestContactEmail , false ) ;
229
231
}
230
232
231
233
private void UpdateContact ( DssOrganization entity , string messageType , string ? emailAddress , bool isPrimary )
@@ -250,5 +252,26 @@ private void UpdateContact(DssOrganization entity, string messageType, string? e
250
252
}
251
253
}
252
254
}
255
+
256
+ public async Task < DssOrganization > CreatePlatformSubAsync ( PlatformSubCreateDto dto )
257
+ {
258
+ var entity = _mapper . Map < DssOrganization > ( dto ) ;
259
+
260
+ entity . OrganizationCd = dto . OrganizationCd . ToUpperInvariant ( ) ;
261
+ entity . OrganizationType = OrganizationTypes . Platform ;
262
+
263
+ await _dbSet . AddAsync ( entity ) ;
264
+
265
+ return entity ;
266
+ }
267
+
268
+ public async Task UpdatePlatformSubAsync ( PlatformSubUpdateDto dto )
269
+ {
270
+ var entity = await _dbSet
271
+ . Include ( x => x . DssOrganizationContactPeople )
272
+ . FirstAsync ( x => x . OrganizationId == dto . OrganizationId ) ;
273
+
274
+ _mapper . Map ( dto , entity ) ;
275
+ }
253
276
}
254
277
}
0 commit comments