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