public JsonResult AddEmergencyContactDetail(EmergencyContactViewModel emergencyContactViewModel)
        {
            _employeeEmergencyContactDetailService.CreateEmergencyContactDetailForEmployee(new CreateEmergencyContactRequest()
                                                                         {
                                                                             EmployeeId = emergencyContactViewModel.EmployeeId,
                                                                             CompanyId = emergencyContactViewModel.CompanyId,
                                                                             Title = emergencyContactViewModel.Title,
                                                                             Forename = emergencyContactViewModel.Forename,
                                                                             Surname = emergencyContactViewModel.Surname,
                                                                             Relationship = emergencyContactViewModel.Relationship,
                                                                             WorkTelephone = emergencyContactViewModel.WorkTelephone,
                                                                             MobileTelephone = emergencyContactViewModel.MobileTelephone,
                                                                             HomeTelephone = emergencyContactViewModel.HomeTelephone,
                                                                             PreferredContactNumber = emergencyContactViewModel.PreferredContactNumber,
                                                                             SameAddressAsEmployee = emergencyContactViewModel.SameAddressAsEmployee,
                                                                             Address1 = emergencyContactViewModel.Address1,
                                                                             Address2 = emergencyContactViewModel.Address2,
                                                                             Address3 = emergencyContactViewModel.Address3,
                                                                             Town = emergencyContactViewModel.Town,
                                                                             County = emergencyContactViewModel.County,
                                                                             CountryId = emergencyContactViewModel.EmergencyContactCountryId.GetValueOrDefault(),
                                                                             PostCode = emergencyContactViewModel.PostCode,
                                                                             UserId = CurrentUser.UserId
                                                                         });
            return Json(new { Success = true });

        }
        public void Given_that_three_telephone_numbers_exists_When_preferened_telephone_number_is_selected_Then_correct_prefered_number_is_set(int preferedNumber, string expectedTelephoneNumber)
        {
            //Given
            var target = new EmergencyContactViewModel
            {
                WorkTelephone = "123",
                HomeTelephone = "456",
                MobileTelephone = "789",
                PreferredContactNumber = preferedNumber
            };

            //When
            var result = target.GetPreferredContactNumber();

            //Then
            Assert.That(result, Is.EqualTo(expectedTelephoneNumber));
        }
 public static EmergencyContactDetailViewModel CreateFrom(EmergencyContactViewModel emergencyContact, EmployeeViewModel employeeViewModel)
 {
     var contactDetail = emergencyContact ?? new EmergencyContactViewModel();
     
     return new EmergencyContactDetailViewModel()
                {
                    ContactDetail = contactDetail,
                    Titles = employeeViewModel.Titles,
                    Countries =employeeViewModel.Countries,
                    SameAddressAsEmployee = emergencyContact != null ? emergencyContact.SameAddressAsEmployee : false,
                    EmployeeAddress1 = employeeViewModel.Address1,
                    EmployeeAddress2 = employeeViewModel.Address2,
                    EmployeeAddress3 = employeeViewModel.Address3,
                    EmployeeTown = employeeViewModel.Town,
                    EmployeeCounty = employeeViewModel.County,
                    EmployeeCountryId = employeeViewModel.CountryId,
                    EmployeePostCode = employeeViewModel.Postcode
                };
 }
 public EmergencyContactDetailViewModel()
 {
     ContactDetail = new EmergencyContactViewModel();
 }