public IEnumerable <Value> Get()
 {
     using (ValuesContext valuesContext = new ValuesContext())
     {
         return(_dbContext.Values.ToList());
     }
 }
示例#2
0
        public async static Task AddLog(this ValuesContext db, int type, string message)
        {
            await db.LogData2s.AddAsync(new Model.LogData2
            {
                InsertDate = DateTime.Now,
                LogData1Id = type,
                Value      = message
            });

            await db.SaveChangesAsync();
        }
 public int Post(string val)
 {
     using (ValuesContext valuesContext = new ValuesContext())
     {
         Value value = new Value()
         {
             Val = val
         };
         _dbContext.Values.Add(value);
         _dbContext.SaveChanges();
         return(value.Id);
     }
 }
示例#4
0
        public ValuesController(ValuesContext context)
        {
            _context = context;

            _context.Database.EnsureCreated();

            if (_context.ValuesItems.Count() == 0)
            {
                _context.ValuesItems.Add(new ValuesItem {
                    x = 42
                });
                _context.SaveChanges();
            }
        }
        public ValuesContext @values()
        {
            ValuesContext _localctx = new ValuesContext(Context, State);

            EnterRule(_localctx, 2, RULE_values);
            int _la;

            try {
                EnterOuterAlt(_localctx, 1);
                {
                    State = 18; Match(LParen);
                    State = 27;
                    ErrorHandler.Sync(this);
                    _la = TokenStream.LA(1);
                    if ((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << Word) | (1L << Int) | (1L << Float))) != 0))
                    {
                        {
                            State = 19; value();
                            State = 24;
                            ErrorHandler.Sync(this);
                            _la = TokenStream.LA(1);
                            while (_la == Comma)
                            {
                                {
                                    {
                                        State = 20; Match(Comma);
                                        State = 21; value();
                                    }
                                }
                                State = 26;
                                ErrorHandler.Sync(this);
                                _la = TokenStream.LA(1);
                            }
                        }
                    }

                    State = 29; Match(RParen);
                }
            }
            catch (RecognitionException re) {
                _localctx.exception = re;
                ErrorHandler.ReportError(this, re);
                ErrorHandler.Recover(this, re);
            }
            finally {
                ExitRule();
            }
            return(_localctx);
        }
示例#6
0
 /// <summary> constructor </summary>
 /// <param name="context">DI DbContext</param>
 public ValuesController(ValuesContext context)
 {
     this.context = context;
 }
示例#7
0
 public ValuesController(ValuesContext valuesContext, ILogger <ValuesController> logger)
 {
     _context = valuesContext;
     _lg      = logger;
 }
 public ValuesManager(ValuesContext valuesContext)
 {
     _valuesContext = valuesContext;
 }
 public ValuesController(ValuesContext dbContext)
 {
     _dbContext = dbContext;
 }