示例#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;
 }
 public Rps_Game(ILogger <Rps_Game> logger, IMemoryCache cache, DatabContext context)
 {
     _logger  = logger;
     _cache   = cache;
     _context = context;
 }