Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers().AddNewtonsoftJson();
            SwaggerConfig.RunServices(services);
            AutoMapping.Setup(services);

            services.AddDbContext <PredictScoreContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
            services.AddScoped <IRepository <User>, UserRepository>();
            services.AddScoped <IUserService, UserService>();
            services.AddScoped <IRepository <Team>, TeamRepository>();
            services.AddScoped <IService <Team>, TeamService>();
            services.AddScoped <IRepository <Sport>, Repository <Sport> >();
            services.AddScoped <IService <Sport>, Service <Sport> >();
            services.AddScoped <IRepository <Score>, Repository <Score> >();
            services.AddScoped <IService <Score>, Service <Score> >();
            services.AddScoped <IRepository <Season>, Repository <Season> >();
            services.AddScoped <ISeasonService, SeasonService>();
            services.AddScoped <IRepository <Round>, RoundRepository>();
            services.AddScoped <IService <Round>, RoundService>();
            services.AddScoped <IRepository <Prediction>, Repository <Prediction> >();
            services.AddScoped <IService <Prediction>, Service <Prediction> >();
            services.AddScoped <IRepository <Group>, GroupRepository>();
            services.AddScoped <IGroupService, GroupService>();
            services.AddScoped <IRepository <Match>, MatchRepository>();
            services.AddScoped <IService <Match>, Service <Match> >();
        }