// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env,
                              APContext context, UserManager <ApplicationUser> userManager,
                              RoleManager <ApplicationRole> roleManager)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseCookiePolicy();

            app.UseAuthentication();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "areaRoute",
                    template: "{area:exists}/{controller=Admin}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            DummyData.Initialize(context, userManager, roleManager).Wait();
        }
        public MainPage()
        {
            InitializeComponent();
            var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library", "EFCore.db");

            using (var db = new APContext(dbPath))
            {
                Appointments app1 = new Appointments()
                {
                    id = 1, PatientName = "Gary", DateOfBirths = Convert.ToDateTime("26/07/77"), Notes = ""
                };
                Appointments app2 = new Appointments()
                {
                    id = 2, PatientName = "Jack", Notes = ""
                };
                Appointments app3 = new Appointments()
                {
                    id = 3, PatientName = "Luna", Notes = ""
                };

                List <Appointments> _appointments = new List <Appointments>()
                {
                    app1, app2, app3
                };
                db.Appointments.AddRange(_appointments);
                db.SaveChanges();
            }
        }
Example #3
0
 public DeliveryService(APContext context, CollectionTools collectionTools, EntityData configuration, IEntityStore store)
 {
     _context         = context;
     _collectionTools = collectionTools;
     _configuration   = configuration;
     _store           = store;
 }
Example #4
0
 public CollectionTools(APContext context, IEntityStore entityStore, EntityData configuration, IServiceProvider serviceProvider)
 {
     _context         = context;
     _entityStore     = entityStore;
     _configuration   = configuration;
     _contextAccessor = (IHttpContextAccessor)serviceProvider.GetService(typeof(IHttpContextAccessor));
 }
Example #5
0
 public DeliveryService(APContext context, CollectionTools collectionTools, EntityData configuration, IEntityStore store, RelevantEntitiesService relevantEntities)
 {
     _context          = context;
     _collectionTools  = collectionTools;
     _configuration    = configuration;
     _store            = store;
     _relevantEntities = relevantEntities;
 }
Example #6
0
 public DeliverToActivityPubTask(EventQueueItem item, IEntityStore entityStore, EntityFlattener entityFlattener, IServiceProvider serviceProvider, DeliveryService deliveryService, APContext context, EntityData data) : base(item)
 {
     _entityStore     = entityStore;
     _entityFlattener = entityFlattener;
     _serviceProvider = serviceProvider;
     _deliveryService = deliveryService;
     _context         = context;
     _data            = data;
 }
Example #7
0
            public SalmonConverter(IEntityStore entityStore, EntityFlattener flattener, AtomEntryParser parser, AtomEntryGenerator generator, SalmonConverterFactory factory, APContext context)
            {
                _entityStore = entityStore;
                _flattener   = flattener;
                _factory     = factory;

                _entryParser    = parser;
                _entryGenerator = generator;
                _context        = context;
            }
Example #8
0
        public BackgroundTaskQueuer(APContext context, IServiceProvider serviceProvider, ILogger <BackgroundTaskQueuer> logger, INotifier notifier)
        {
            _context         = context;
            _serviceProvider = serviceProvider;
            _logger          = logger;
            _notifier        = notifier;

            _notifier.Subscribe(BackgroundTaskPath, (a) => _cancellationTokenSource?.Cancel());

            _do();
        }
Example #9
0
 public AdminController(APContext context, IEntityStore entityStore, EntityData entityData, JwtTokenSettings tokenSettings, SignInManager <APUser> signInManager, IServiceProvider provider, IConfigurationRoot configuration, EntityFlattener flattener, UserManager <APUser> userManager, RelevantEntitiesService relevantEntities, CollectionTools collectionTools)
 {
     _context          = context;
     _entityStore      = entityStore;
     _entityData       = entityData;
     _tokenSettings    = tokenSettings;
     _signInManager    = signInManager;
     _provider         = provider;
     _configuration    = configuration;
     _flattener        = flattener;
     _userManager      = userManager;
     _relevantEntities = relevantEntities;
     _collectionTools  = collectionTools;
 }
Example #10
0
 public AuthController(APContext context, UserManager <APUser> userManager, SignInManager <APUser> signInManager, JwtTokenSettings tokenSettings, EntityFlattener entityFlattener, IEntityStore entityStore, AtomEntryParser entryParser, AtomEntryGenerator entryGenerator, EntityData entityConfiguration, IDataProtectionProvider dataProtectionProvider, IConfigurationRoot configuration, DeliveryService deliveryService)
 {
     _context             = context;
     _userManager         = userManager;
     _signInManager       = signInManager;
     _tokenSettings       = tokenSettings;
     _entityFlattener     = entityFlattener;
     _entityStore         = entityStore;
     _entryParser         = entryParser;
     _entryGenerator      = entryGenerator;
     _entityConfiguration = entityConfiguration;
     _dataProtector       = dataProtectionProvider.CreateProtector("OAuth tokens");
     _configuration       = configuration;
     _deliveryService     = deliveryService;
 }
Example #11
0
 public GetEntityHandler(APContext acontext, EntityFlattener flattener, IEntityStore mainStore,
                         AtomEntryGenerator entryGenerator, IServiceProvider serviceProvider, DeliveryService deliveryService,
                         EntityData entityData, ClaimsPrincipal user, CollectionTools collectionTools, INotifier notifier, JwtTokenSettings tokenSettings)
 {
     _context         = acontext;
     _flattener       = flattener;
     _mainStore       = mainStore;
     _entryGenerator  = entryGenerator;
     _serviceProvider = serviceProvider;
     _entityData      = entityData;
     _deliveryService = deliveryService;
     _user            = user;
     _collectionTools = collectionTools;
     _notifier        = notifier;
     _tokenSettings   = tokenSettings;
 }
Example #12
0
        public static async Task Go(APContext context, EventQueueItem item, IServiceProvider provider)
        {
            var type = Type.GetType("Kroeg.Server.BackgroundTasks." + item.Action);

            var resolved = (BaseTask)ActivatorUtilities.CreateInstance(provider, type, item);

            try
            {
                await resolved.Go();

                context.EventQueue.Remove(item);
            }
            catch (Exception)
            {
                // failed
                item.AttemptCount++;
                item.NextAttempt = resolved.NextTry(item.AttemptCount);
            }

            await context.SaveChangesAsync();
        }
Example #13
0
 public CreateActorHandler(StagingEntityStore entityStore, APEntity mainObject, APEntity actor, APEntity targetBox, ClaimsPrincipal user, CollectionTools collection, EntityData entityData, APContext context) : base(entityStore, mainObject, actor, targetBox, user)
 {
     _collection = collection;
     _entityData = entityData;
     _context    = context;
 }
Example #14
0
 public RelevantEntitiesService(APContext context)
 {
     _context = context;
 }
Example #15
0
 public AtomEntryParser(IEntityStore entityStore, EntityData entityConfiguration, APContext context)
 {
     _entityStore         = entityStore;
     _entityConfiguration = entityConfiguration;
     _context             = context;
 }
Example #16
0
 public FakeEntityService(APContext context, EntityData configuration)
 {
     _context       = context;
     _configuration = configuration;
 }
Example #17
0
 public WebSubHandler(StagingEntityStore entityStore, APEntity mainObject, APEntity actor, APEntity targetBox, ClaimsPrincipal user, APContext context) : base(entityStore, mainObject, actor, targetBox, user)
 {
     _context = context;
 }
Example #18
0
 public CatalogService(APContext context, ICatalogMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Example #19
0
 public DeliverToSalmonTask(EventQueueItem item, IEntityStore entityStore, APContext context, AtomEntryGenerator entryGenerator) : base(item)
 {
     _entityStore    = entityStore;
     _context        = context;
     _entryGenerator = entryGenerator;
 }
Example #20
0
 public EnderecoCobrancaController(APContext context)
 {
     _context = context;
 }
Example #21
0
 public UserAuthenticationService(APContext context)
 {
     _context = context;
 }
Example #22
0
 public WebSubBackgroundTask(EventQueueItem item, IEntityStore entityStore, APContext context, CollectionTools collectionTools) : base(item)
 {
     _entityStore     = entityStore;
     _context         = context;
     _collectionTools = collectionTools;
 }
Example #23
0
 public EntityFlattener(APContext context, EntityData configuration)
 {
     _configuration = configuration;
     _context       = context;
 }
Example #24
0
 public WellKnownController(APContext context, IEntityStore entityStore, EntityData entityData)
 {
     _context     = context;
     _entityStore = entityStore;
     _entityData  = entityData;
 }
 public MenuRepository(APContext context) : base(context)
 {
 }
Example #26
0
 public UserService(APContext context)
 {
     _context = context;
 }
Example #27
0
 public ListaInstalacaoController(APContext context)
 {
     _context = context;
 }
Example #28
0
        public static async Task Initialize(APContext context, UserManager <ApplicationUser> userManager, RoleManager <ApplicationRole> roleManager)
        {
            context.Database.EnsureCreated();

            string role1 = "Admin";
            string desc1 = "Perfil de Administrador";

            string role2 = "Membro";
            string desc2 = "Perfil de Membro";

            string password = "******";

            if (await roleManager.FindByNameAsync(role1) == null)
            {
                await roleManager.CreateAsync(new ApplicationRole(role1, desc1, DateTime.Now));
            }
            if (await roleManager.FindByNameAsync(role2) == null)
            {
                await roleManager.CreateAsync(new ApplicationRole(role2, desc2, DateTime.Now));
            }

            if (await userManager.FindByNameAsync("leandro") == null)
            {
                var user = new ApplicationUser
                {
                    UserName         = "******",
                    Email            = "*****@*****.**",
                    FirstName        = "Leandro",
                    LastName         = "Rovagnoli",
                    Street           = "Rua Fake, 55",
                    City             = "São Paulo",
                    State            = "SP",
                    PostalCode       = "02752000",
                    Country          = "Brasil",
                    PhoneNumber      = "11980798740",
                    RegistrationDate = DateTime.Now
                };

                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, role1);
                }
            }

            if (await userManager.FindByNameAsync("eduardo") == null)
            {
                var user = new ApplicationUser
                {
                    UserName         = "******",
                    Email            = "*****@*****.**",
                    FirstName        = "Eduardo",
                    LastName         = "Fernandes",
                    Street           = "Rua Copacabana, 10",
                    City             = "São Paulo",
                    State            = "SP",
                    PostalCode       = "02752000",
                    Country          = "Brasil",
                    PhoneNumber      = "11998795401",
                    RegistrationDate = DateTime.Now
                };

                var result = await userManager.CreateAsync(user);

                if (result.Succeeded)
                {
                    await userManager.AddPasswordAsync(user, password);

                    await userManager.AddToRoleAsync(user, role2);
                }
            }
        }
Example #29
0
 public DatabaseEntityStore(APContext context)
 {
     _context = context;
 }
Example #30
0
 public FaturaController(APContext context)
 {
     _context = context;
 }