/// <summary>
 /// Creates a new instance of the service with the context to query and the validators.
 /// </summary>
 /// <param name="context">The context to operate against.</param>
 /// <param name="exchangeVisitorService">The exchange visitor service that is capable of executing validation.</param>
 /// <param name="exchangeVisitorValidator">The update exchange visitor validator.</param>
 /// <param name="saveActions">The context save actions.</param>
 public ExchangeVisitorValidationService(
     EcaContext context,
     IExchangeVisitorService exchangeVisitorService,
     IParticipantPersonsSevisService participantPersonSevisService,
     AbstractValidator <ExchangeVisitor> exchangeVisitorValidator = null,
     List <ISaveAction> saveActions = null)
     : base(context, saveActions)
 {
     Contract.Requires(exchangeVisitorService != null, "The exchange visitor service must not be null.");
     Contract.Requires(context != null, "The context must not be null.");
     Contract.Requires(participantPersonSevisService != null, "The participantPersonSevisService must not be null.");
     this.exchangeVisitorService        = exchangeVisitorService;
     this.participantPersonSevisService = participantPersonSevisService;
     if (exchangeVisitorValidator == null)
     {
         this.ExchangeVisitorValidator = new ExchangeVisitorValidator();
     }
     else
     {
         this.ExchangeVisitorValidator = exchangeVisitorValidator;
     }
     throwIfModelDoesNotExist = (id, instance, type) =>
     {
         if (instance == null)
         {
             throw new ModelNotFoundException(String.Format("The model of type [{0}] with id [{1}] was not found.", type.Name, id));
         }
     };
 }
Exemple #2
0
 /// <summary>
 /// Creates a new instance with the service to use and the app settings.
 /// </summary>
 /// <param name="participantPersonsSevisService">The service.</param>
 /// <param name="exchangeVisitorValidationService">The exchange visitor validation service.</param>
 /// <param name="appSettings">The app settings.</param>
 public Functions(IParticipantPersonsSevisService participantPersonsSevisService, IExchangeVisitorValidationService exchangeVisitorValidationService, AppSettings appSettings)
 {
     Contract.Requires(participantPersonsSevisService != null, "The service must not be null.");
     Contract.Requires(appSettings != null, "The app settings must not be null.");
     Contract.Requires(exchangeVisitorValidationService != null, "The exchange visitor validation service must not be null.");
     this.participantPersonsSevisService = participantPersonsSevisService;
     this.appSettings = appSettings;
     this.exchangeVisitorValidationService = exchangeVisitorValidationService;
 }
Exemple #3
0
 /// <summary>
 /// Creates a new ParticipantPersonsSevisController with the given service.
 /// </summary>
 /// <param name="participantService">The participant person sevis service.</param>
 /// <param name="userProvider">The user provider</param>
 /// <param name="appSettings">The application settings.</param>
 /// <param name="storageHandler">The file storage handler.</param>
 public ParticipantPersonsSevisController(IParticipantPersonsSevisService participantService, IUserProvider userProvider, IFileStorageHandler storageHandler, AppSettings appSettings)
 {
     Contract.Requires(participantService != null, "The participantPersonSevis service must not be null.");
     Contract.Requires(userProvider != null, "The user provider must not be null.");
     Contract.Requires(storageHandler != null, "The storage handler must not be null.");
     this.participantService = participantService;
     this.userProvider       = userProvider;
     this.storageHandler     = storageHandler;
     this.appSettings        = appSettings;
 }