コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] Value value)
        {
            if (id != value.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(value);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ValueExists(value.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(value));
        }
コード例 #2
0
        private static void Query(SQLiteDbContext db)
        {
            //var u = new User {
            //    Name = "测试"
            //};

            //db.Add<User>(u);

            var aa1 = db.Query <User>(x => x.Id > 12).Select(x => new { title = x.Name }).ToList();

            var aa = db.Query <User>(x => x.Id > 0).ToList();

            var d = db.SqlQueryDynamic(" select * from users ", null);

            var dta = db.SqlQueryDataTable(" select * from users ", null);

            db.Update <User>(x => x.Id > 0, x => new User {
                Name = "212"
            });

            db.Query <User>(x => x.Id == 12).FirstOrDefault();
        }