Exemple #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());
     }
 }
Exemple #2
0
 public Admin GetById(string id)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Admins.Find(id));
     }
 }
Exemple #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());
     }
 }
Exemple #4
0
 public Command GetById(string id)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Commands.Find(id));
     }
 }
Exemple #5
0
 public Admin Get(Expression <Func <Admin, bool> > where)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Admins.Where(where).FirstOrDefault());
     }
 }
Exemple #6
0
 public IEnumerable <Admin> GetAll()
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Admins);
     }
 }
Exemple #7
0
 public IEnumerable <Claim> GetAll()
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Claims.AsEnumerable());
     }
 }
Exemple #8
0
 public Claim GetById(string id)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Claims.Find(id));
     }
 }
Exemple #9
0
 public Claim Get(Expression <Func <Claim, bool> > where)
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Claims.Where(where).FirstOrDefault());
     }
 }
Exemple #10
0
 public void Commit()
 {
     using (var ctx = new DatabContext())
     {
         ctx.SaveChanges();
     }
 }
Exemple #11
0
 public IEnumerable <Command> GetAll()
 {
     using (var ctx = new DatabContext())
     {
         return(ctx.Commands.Include(x => x.product).AsEnumerable());
     }
 }
Exemple #12
0
 public void Add(Claim entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Claims.Add(entity);
         ctx.SaveChanges();
     }
 }
Exemple #13
0
 public void Add(Admin entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Admins.Add(entity);
         ctx.SaveChanges();
     }
 }
Exemple #14
0
 /**************************************************************/
 public void Add(Command entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Commands.Add(entity);
         ctx.SaveChanges();
     }
 }
Exemple #15
0
 public void Delete(Claim entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Claims.Remove(entity);
         ctx.SaveChanges();
     }
 }
Exemple #16
0
 public void Delete(Admin entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Admins.Remove(entity);
         ctx.SaveChanges();
     }
 }
Exemple #17
0
 public void Delete(Command entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Commands.Attach(entity);
         ctx.Commands.Remove(entity);
         ctx.SaveChanges();
     }
 }
Exemple #18
0
 public void Update(Command entity)
 {
     using (var ctx = new DatabContext())
     {
         ctx.Commands.Attach(entity);
         ctx.Entry(entity).State = EntityState.Modified;
         ctx.SaveChanges();
     }
 }
Exemple #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();
     }
 }
Exemple #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();
            }
        }
Exemple #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();
            }
        }
Exemple #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());
            }
        }
Exemple #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());
            }
        }
Exemple #24
0
 public UnitOfWork(IDatabaseFactory dbFactory)
 {
     this.dbFactory = dbFactory;
     dataContext    = dbFactory.DataContext;
 }
Exemple #25
0
 public DatabaseFactory()
 {
     dataContext = new DatabContext();
 }
Exemple #26
0
 public TodoItemsController(DatabContext context)
 {
     _context = context;
 }
 public Rps_Game(ILogger <Rps_Game> logger, IMemoryCache cache, DatabContext context)
 {
     _logger  = logger;
     _cache   = cache;
     _context = context;
 }