public CustomerDemographicResponse Any(CustomerDemographicAddRequest request) { if (Validator != null) { Validator.ValidateAndThrow(request, ApplyTo.Post); } OnBeforeCustomerDemographicAddRequest(request); var output = Repository.Create(request); OnAfterCustomerDemographicAddRequest(request, output); return(output); }
public CustomerDemographicResponse Create(CustomerDemographicAddRequest request) { using (var adapter = DataAccessAdapterFactory.NewDataAccessAdapter()) { OnBeforeCustomerDemographicAddRequest(adapter, request); var entity = request.FromDto(); entity.IsNew = true; if (adapter.SaveEntity(entity, true)) { OnAfterCustomerDemographicAddRequest(adapter, request); return(new CustomerDemographicResponse(entity.ToDto())); } } throw new InvalidOperationException(); }
partial void OnAfterCustomerDemographicAddRequest(IDataAccessAdapter adapter, CustomerDemographicAddRequest request);
partial void OnAfterCustomerDemographicAddRequest(CustomerDemographicAddRequest request, CustomerDemographicResponse response);
partial void OnBeforeCustomerDemographicAddRequest(CustomerDemographicAddRequest request);