Example #1
0
        public ArticleController(IArticleService articleService, IHttpContextAccessor httpContext, IPropertyMappingService propertyMappingService,
                                 IPropertyCheckService propertyCheckService)
        {
            _articleService         = articleService ?? throw new ArgumentNullException(nameof(articleService));
            _propertyMappingService = propertyMappingService ?? throw new ArgumentNullException(nameof(propertyMappingService));
            _propertyCheckService   = propertyCheckService ?? throw new ArgumentNullException(nameof(propertyCheckService));
            var accessor = httpContext ?? throw new ArgumentNullException(nameof(httpContext));

            _userId = JwtHelper.JwtDecrypt(accessor.HttpContext.Request.Headers["Authorization"]).UserId;
        }
Example #2
0
 public CompaniesController(ICompanyRepository companyRepository, IMapper mapper,
                            IPropertyMappingService propertyMappingService, IPropertyCheckService propertyCheckService)
 {
     this._companyRepository = companyRepository ??
                               throw new ArgumentNullException(nameof(companyRepository));
     this._mapper = mapper ??
                    throw new ArgumentNullException(nameof(mapper));
     this._propertyMappingService = propertyMappingService ??
                                    throw new ArgumentNullException(nameof(propertyMappingService));
     this._propertyCheckService = propertyCheckService ??
                                  throw  new ArgumentNullException(nameof(propertyCheckService));
 }
        public static PropertyChecksController GetInitialisedChecksController(IPropertyCheckService checkService)
        {
            var controller = new PropertyChecksController(checkService)
            {
                Request = new HttpRequestMessage { RequestUri = new Uri(Url) },
                Configuration = new HttpConfiguration()
            };

            controller.Configuration.MapHttpAttributeRoutes();
            controller.Configuration.EnsureInitialized();

            return controller;
        }
Example #4
0
        public GasLogController(IGasLogManager gasLogManager, IMapper mapper,
                                IAutoEntityManager <AutomobileInfo> autoManager,
                                IAutoEntityManager <GasDiscount> discountManager,
                                IPropertyMappingService propertyMappingService,
                                IPropertyCheckService propertyCheckService)
        {
            Guard.Against <ArgumentNullException>(gasLogManager == null, nameof(gasLogManager));
            Guard.Against <ArgumentNullException>(mapper == null, nameof(mapper));
            Guard.Against <ArgumentNullException>(autoManager == null, nameof(autoManager));
            Guard.Against <ArgumentNullException>(discountManager == null, nameof(discountManager));
            Guard.Against <ArgumentNullException>(propertyMappingService == null, nameof(propertyMappingService));
            Guard.Against <ArgumentNullException>(propertyCheckService == null, nameof(propertyCheckService));

            _gasLogManager          = gasLogManager;
            _mapper                 = mapper;
            _autoManager            = autoManager;
            _discountManager        = discountManager;
            _propertyMappingService = propertyMappingService;
            _propertyCheckService   = propertyCheckService;
        }
        public PropertyChecksController(IPropertyCheckService checkService)
        {
            Check.If(checkService).IsNotNull();

            _checkService = checkService;
        }