public ParityOfTheWeekService( IOptions <ParityOfTheWeekConfigurationModel> parityOfTheWeekConfigurationModel, IMapper mapper ) { _parityOfTheWeekConfigurationModel = parityOfTheWeekConfigurationModel.Value ?? throw new ArgumentNullException(nameof(parityOfTheWeekConfigurationModel)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); }
public static ParityOfTheWeekConfigurationModel GetConfigurationValues() { var result = new ParityOfTheWeekConfigurationModel { StartLearningYear = 2016 }; return(result); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("CorsPolicy", builder => builder.AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); }); services.AddScoped <IParityOfTheWeekService, ParityOfTheWeekService>(); services.AddSingleton(ParityOfTheWeekConfigurationModel.GetConfigurationValues()); services.AddAutoMapper(); services.AddMvc(); }
public ParityOfTheWeekService(IMapper mapper, ParityOfTheWeekConfigurationModel config) { _mapper = mapper; _config = config; }