示例#1
0
        public ActionResult DeleteChat(int id)
        {
            var c = new Chat {
                Id = id
            };

            _db.Entry(c).State = EntityState.Deleted;
            _db.SaveChanges();

            return(RedirectToAction("ListChats", "Home"));
        }
 public ActionResult EditUser(string actionType, User u)
 {
     if (actionType == Resources.Resource.Save)
     {
         // сохраняем изменения в базе данных
         _db.Entry(u).State = EntityState.Modified;
         _db.SaveChanges();
     }
     else if (actionType == Resources.Resource.Cancel)
     {
         // от измененяемния в базе данных
         _db.Entry(u).State = EntityState.Unchanged;
     }
     return(RedirectToAction("ListUsers", "Account"));
 }