Пример #1
0
        public async Task EditAsync(T model, bool saved = true)
        {
            _db.Configuration.ValidateOnSaveEnabled = false;//EF关闭检查
            _db.Entry(model).State = EntityState.Modified;
            if (saved)
            {
                await _db.SaveChangesAsync();

                _db.Configuration.ValidateOnSaveEnabled = true;
            }
        }
Пример #2
0
 public ActionResult Edit([Bind(Include = "Id,Name,Controller,Action,CreateTime,IsRemove")] SideBars sideBars)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sideBars).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sideBars));
 }