public void CreateEvent(int client_id, int cours_id, string date, string time) { Mapper.CreateMap <ClientDTO, ClientViewModel>(); var client = Mapper.Map <ClientDTO, ClientViewModel>(crmService.GetClient(client_id)); Mapper.CreateMap <CoursDTO, CoursViewModel>(); var cours = Mapper.Map <CoursDTO, CoursViewModel>(crmService.GetCours(cours_id)); EventViewModel events = new EventViewModel(); events.client_id = client_id; events.client_name = client.name; events.client_sname = client.sname; events.cours_id = cours_id; events.cours_name = cours.cname; events.date = date; events.time = time; Mapper.CreateMap <EventViewModel, EventDTO>(); var eventDto = Mapper.Map <EventViewModel, EventDTO>(events); crmService.AddEvent(eventDto); }