public void Save(Task task)
        {
            var db         = new LiteDbContext();
            var collection = db.Context.GetCollection <Task>("tasks");

            collection.Upsert(task);
        }
        public List <Task> GetAllTasks()
        {
            var db         = new LiteDbContext();
            var collection = db.Context.GetCollection <Task>("tasks");

            return(collection.FindAll().ToList());
        }
        public void Delete(ObjectId id)
        {
            var db         = new LiteDbContext();
            var collection = db.Context.GetCollection <Task>("tasks");

            collection.Delete(c => c.Id == id);
        }
Example #4
0
        public BaseController(LiteDbContext context, IConfiguration configuration)
        {
            _configuration = configuration;
            _database      = context.Context;

            int.TryParse(configuration["PageSize"], out _pageSize);
        }
 public PlayerService(ILogger<PlayerService> logger, IHttpClientFactory clientFactory,
     LiteDbContext dbContext)
 {
     _logger = logger;
     _clientFactory = clientFactory;
     _database = dbContext;
     _random = new Random();
 }
Example #6
0
        public BaseRepository(LiteDbContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            this.context = context;
        }
        public HomeController(LiteDbContext db)
        {
            //Primer insert que se realiza cuando se corre el programa
            this.db = db;
            var master = db.Context.GetCollection <Supermercado>("supermercado");

            var supermercado = new Supermercado();

            master.Insert(supermercado);
        }
Example #8
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            CoreState.AddContextWithSwagger(services, "http://172.17.9.105:1600/api", "postman", "postman", "postman");

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            ContainerBuilder builder = new ContainerBuilder();

            services.AddCors();
            Assembly assembly = typeof(IRepositoryCore <,>).Assembly;

            //builder.RegisterGeneric(typeof(IRepositoryCore<,>), assembly);
            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
            // Assembly[] assemblies = GetYourAssemblies();
            builder.RegisterGeneric(typeof(LiteRepository.Repository.LiteRepository <>))
            .As(typeof(IRepositoryCore <,>))
            .InstancePerLifetimeScope();
            var lite = new LiteDbContext();

            builder.RegisterInstance(lite).As <ILiteContext>();
            Service.Start.Builder(builder);
            builder.Populate(services);
            Container = builder.Build();
            return(new AutofacServiceProvider(Container));
        }
Example #9
0
 public CajaController(LiteDbContext db)
 {
     this.db = db;
 }
Example #10
0
 //inyeccion del contexto de la base de datos
 public EmpleadoController(LiteDbContext db)
 {
     this.db = db;
 }
Example #11
0
 public UserDao(LiteDbContext con)
 {
     _userTable = con.Database.GetCollection <UserTable>();
 }
 public UserAvatarStorage(LiteDbContext liteDbContext)
 {
     this.liteDbContext = liteDbContext;
 }
Example #13
0
 public LiteDbUserStore(LiteDbContext dbContext)
 {
     _users = dbContext.LiteDatabase.GetCollection <TUser>("users");
     _cancellationTokens = dbContext.LiteDatabase.GetCollection <CancellationToken>("cancellationtokens");
 }
Example #14
0
        public void OnGet([FromServices] LiteDbContext db)
        {
            var bugs = db.Context.GetCollection <Bug>();

            Bugs = bugs.FindAll();
        }
 public ArticuloController(LiteDbContext db)
 {
     this.db = db;
 }
 public LiteDbRoleStore(LiteDbContext dbContext)
 {
     _roles = dbContext.LiteDatabase.GetCollection <TRole>("roles");
 }
Example #17
0
 public HomeController(LiteDbContext context)
 {
     repo = context.LiteRepository;
 }
 public KeyValuePairWithExpirationRepository(LiteDbContext context)
     : base(context)
 {
 }
 public IncidentController(ILogger <IncidentController> logger, LiteDbContext db)
 {
     this.logger = logger;
     incidents   = db.Context.GetCollection <Incident>();
 }
Example #20
0
        public void OnGet([FromServices] LiteDbContext db)
        {
            var clientes = db.Context.GetCollection <Cliente>();

            Clientes = clientes.FindAll();
        }
 public UserManagementRepository(IDomainEventPublisher eventPublisher, LiteDbContext dbContext) : base(eventPublisher, dbContext)
 {
 }
Example #22
0
 public HomeController(LiteDbContext db)
 {
     _db = db;
 }
Example #23
0
 public ProjectionDbSession(LiteDbContext context, TRepository repository)
 {
     Context    = context;
     Repository = repository;
 }
Example #24
0
 public CapsStorage(LiteDbContext liteDbContext)
 {
     this.liteDbContext = liteDbContext;
 }
Example #25
0
 public CreateModel(LiteDbContext db)
 {
     _db = db;
 }
Example #26
0
 public APIController(LiteDbContext context, IConfiguration configuration) : base(context, configuration)
 {
 }
Example #27
0
 public AdapterRepository(LiteDbContext liteDb)
 {
     _liteDb = liteDb;
 }
Example #28
0
 public VideoDao(LiteDbContext con)
 {
     _videoTable = con.Database.GetCollection <VideoTable>();
 }
Example #29
0
 public IndexModel(LiteDbContext db)
 {
     _db = db;
 }
Example #30
0
 public LiteDBDAL(LiteDbContext context)
 {
     _context = context.Context;
 }