static void Main string args IMapper mapper AutoMapperWebApiConf igura

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
static void Main(string[] args) {
IMapper mapper = AutoMapperWebApiConfiguration.Configure().CreateMapper();
SearchingService searchingService = new SearchingService();
RegistrationService registrationService = new RegistrationService(new LibraryUnitOfWork());
UserCardModel userCard1 = new UserCardModel("FirstName1", "LastName1");
UserCardModel userCard2 = new UserCardModel("FirstName2", "LastName2");
UserCardModel userCard3 = new UserCardModel("FirstName3", "LastName3");
UserCardModel userCard4 = new UserCardModel("FirstName4", "LastName4");
registrationService.RegisterUserCard(mapper.Map<UserCardModel, UserCardDTO>(userCard1));
registrationService.RegisterUserCard(mapper.Map<UserCardModel, UserCardDTO>(userCard2));
registrationService.RegisterUserCard(mapper.Map<UserCardModel, UserCardDTO>(userCard3));
registrationService.RegisterUserCard(mapper.Map<UserCardModel, UserCardDTO>(userCard4));
UserCardModel userCard5 = mapper.Map<UserCardDTO, UserCardModel>(searchingService.FindUserCard(card => card.Id == 1));
}