// Create entity from model. public PointOfContact(PointOfContactModel model) { FirstName = model.FirstName; LastName = model.LastName; Title = model.Title; Address = new SystemAddress(model.Address); PhoneNumber = new SystemPhoneNumber(model.PhoneNumber); EmailAddress = new SystemEmailAddress(model.EmailAddress); }
public async Task <PointOfContactModel> Validate(PointOfContactModel model) { if (model.FirstName == string.Empty) { throw new PointOfContactFirstNameIsRequiredException(); } if (model.LastName == string.Empty) { throw new PointOfContactLastNameIsRequiredException(); } if (model.Title == string.Empty) { throw new PointOfContactTitleIsRequiredException(); } await _addressService.Validate(model.Address); await _phoheNumberService.Validate(model.PhoneNumber); await _emailAddressService.Validate(model.EmailAddress); return(model); }