Exemplo n.º 1
0
 public Command Get(Expression <Func <Command, bool> > where)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Commands.Where(where).Include(x => x.product).FirstOrDefault());
     }
 }
Exemplo n.º 2
0
 public Admin GetById(string id)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Admins.Find(id));
     }
 }
Exemplo n.º 3
0
 public Command GetById(long id)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Commands.Include(x => x.product).Where(w => w.idcmd == id).FirstOrDefault());
     }
 }
Exemplo n.º 4
0
 public Command GetById(string id)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Commands.Find(id));
     }
 }
Exemplo n.º 5
0
 public Admin Get(Expression <Func <Admin, bool> > where)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Admins.Where(where).FirstOrDefault());
     }
 }
Exemplo n.º 6
0
 public IEnumerable <Admin> GetAll()
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Admins);
     }
 }
Exemplo n.º 7
0
 public IEnumerable <Claim> GetAll()
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Claims.AsEnumerable());
     }
 }
Exemplo n.º 8
0
 public Claim GetById(string id)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Claims.Find(id));
     }
 }
Exemplo n.º 9
0
 public Claim Get(Expression <Func <Claim, bool> > where)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Claims.Where(where).FirstOrDefault());
     }
 }
Exemplo n.º 10
0
 public void Commit()
 {
     using (var ctx = new DatabContext())
     {
         ctx.SaveChanges();
     }
 }
Exemplo n.º 11
0
 public IEnumerable <Command> GetAll()
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Commands.Include(x => x.product).AsEnumerable());
     }
 }
Exemplo n.º 12
0
 public void Add(Claim entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Claims.Add(entity);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 13
0
 public void Add(Admin entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Admins.Add(entity);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 14
0
 /**************************************************************/
 public void Add(Command entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Commands.Add(entity);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 15
0
 public void Delete(Claim entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Claims.Remove(entity);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 16
0
 public void Delete(Admin entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Admins.Remove(entity);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 17
0
 public void Delete(Command entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Commands.Attach(entity);
         ctx.Commands.Remove(entity);
         ctx.SaveChanges();
     }
 }
Exemplo n.º 18
0
 public void Update(Command entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Commands.Attach(entity);
         ctx.Entry(entity).State = EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemplo n.º 19
0
 public void Delete(Expression <Func <Admin, bool> > where)
 {
     using (var ctx = new DatabContext())
     {
         IEnumerable <Admin> objects = ctx.Admins.Where(where).AsEnumerable();
         foreach (Admin obj in objects)
         {
             ctx.Admins.Remove(obj);
         }
         ctx.SaveChanges();
     }
 }
Exemplo n.º 20
0
        public void Delete(Expression <Func <Claim, bool> > where)
        {
            IEnumerable <Claim> objects;

            using (var ctx = new DatabContext())
            {
                objects = ctx.Claims.Where(where).AsEnumerable();
                foreach (Claim obj in objects)
                {
                    ctx.Claims.Remove(obj);
                }
                ctx.SaveChanges();
            }
        }
Exemplo n.º 21
0
        public void Delete(Expression <Func <Command, bool> > where)
        {
            IEnumerable <Command> objects;

            using (var ctx = new DatabContext())
            {
                objects = ctx.Commands.Where(where).AsEnumerable();


                ctx.Commands.RemoveRange(objects);



                ctx.SaveChanges();
            }
        }
Exemplo n.º 22
0
        public IEnumerable <Admin> GetMany(Expression <Func <Admin, bool> > where = null, Expression <Func <Admin, bool> > orderBy = null)
        {
            IQueryable <Admin> Query;

            using (var ctx = new DatabContext())
            {
                Query = ctx.Admins;
                if (where != null)
                {
                    Query = Query.Where(where);
                }
                if (orderBy != null)
                {
                    Query = Query.OrderBy(orderBy);
                }
                return(Query.ToList());
            }
        }
Exemplo n.º 23
0
        public IEnumerable <Command> GetMany(Expression <Func <Command, bool> > where = null, Expression <Func <Command, bool> > orderBy = null)
        {
            IQueryable <Command> Query;

            using (var ctx = new DatabContext())
            {
                Query = ctx.Commands.Include(x => x.product);
                if (where != null)
                {
                    Query = Query.Where(where);
                }
                if (orderBy != null)
                {
                    Query = Query.OrderBy(orderBy);
                }
                return(Query.ToList());
            }
        }
Exemplo n.º 24
0
 public UnitOfWork(IDatabaseFactory dbFactory)
 {
     this.dbFactory = dbFactory;
     dataContext    = dbFactory.DataContext;
 }
Exemplo n.º 25
0
 public DatabaseFactory()
 {
     dataContext = new DatabContext();
 }
Exemplo n.º 26
0
 public TodoItemsController(DatabContext context)
 {
     _context = context;
 }
Exemplo n.º 27
0
 public Rps_Game(ILogger <Rps_Game> logger, IMemoryCache cache, DatabContext context)
 {
     _logger  = logger;
     _cache   = cache;
     _context = context;
 }