Esempio n. 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddDbContext <DP_MainContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultDatabase")));

            services.AddMvc(options =>
            {
                options.RespectBrowserAcceptHeader = true; // false by default
                options.OutputFormatters.Insert(0, new XMLOutputFormatter());
            })
            .SetCompatibilityVersion(CompatibilityVersion.Version_2_2)
            .AddXmlDataContractSerializerFormatters();

            services.AddOData();
            services.AddODataQueryFilter();

            services.AddScoped <IPartnersRepository, PartnersRepository>();
            services.AddScoped <IPartnersService, PartnersService>();
            services.AddScoped <IStmApiClientsRepository, StmApiClientsRepository>();
            services.AddScoped <IStmApiClientsService, StmApiClientsService>();
            services.AddScoped <IRefMediaTypesRepository, RefMediaTypesRepository>();
            services.AddScoped <IRefMediaTypesService, RefMediaTypesService>();
            services.AddScoped <IDtBasesRepository, DtBasesRepository>();
            services.AddScoped <IDtBasesService, DtBasesService>();
            services.AddScoped <IDtTechsRepository, DtTechsRepository>();
            services.AddScoped <IDtTechsService, DtTechsService>();

            var optionsBuilder = new DbContextOptionsBuilder <DP_MainContext>();

            optionsBuilder.UseSqlServer(Configuration.GetConnectionString("DefaultDatabase"));
            using (var _context = new DP_MainContext(optionsBuilder.Options))
            {
                new AKeys(_context.Stm_Api_Clients.Select(s => s.Api_Key).ToList());
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> GetAsync()
        {
            using (var mainContext = new DP_MainContext())
            {
                using (var publishingUnit = new UnitOfWork <RefMediaType>(mainContext))
                {
                    var result = await publishingUnit.Repository.Get();

                    var data = result.Select(type => new
                    {
                        MediaType  = type.MediaType,
                        LastUpdate = type.LastUpdated,
                        deleted    = type.Deleted
                    });
                    return(Ok(data));
                }
            }
        }
 public RefMediaTypeRepository(DP_MainContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public StmApiClientsRepository(DP_MainContext context)
 {
     _context = context;
 }
 public StmApiClientsController(DP_MainContext context)
 {
     _context = context;
 }
Esempio n. 6
0
 public DtBaseRepository(DP_MainContext context)
 {
     _context = context;
 }
Esempio n. 7
0
 public AuthClientAPIKeyServices(DP_MainContext context)
 {
     _context = context;
 }
Esempio n. 8
0
 public DtBaseController(DP_MainContext context)
 {
     _context = context;
 }
Esempio n. 9
0
 public TechsController(IDtTechsService dtTechsService, DP_MainContext context)
 {
     _dtTechsService = dtTechsService;
     _context        = context;
 }
Esempio n. 10
0
 public RefPartnersRepository(DP_MainContext context)
 {
     _context = context;
 }
Esempio n. 11
0
        private readonly DP_MainContext _context; // DP_MainContext context


        public DtTechRepository(DP_MainContext context)
        {
            _context = context;
        }
Esempio n. 12
0
 public RefPartnersController(DP_MainContext context)
 {
     _context = context;
 }
Esempio n. 13
0
 public DtTechController(DP_MainContext context)
 {
     _context = context;
 }
 public RefMediaTypeController(DP_MainContext context)
 {
     _context = context;
 }