Exemplo n.º 1
0
 public void Delete(Users user)
 {
     using (UspaDbEntities db = new UspaDbEntities())
     {
         if (user != null)
         {
             db.Entry(user).State = System.Data.Entity.EntityState.Deleted;
             db.SaveChanges();
         }
     }
 }
Exemplo n.º 2
0
        public void Delete(string id)
        {
            using (UspaDbEntities db = new UspaDbEntities())
            {
                Users user = db.Users.FirstOrDefault(u => u.Id == id);

                if (user != null)
                {
                    db.Entry(user).State = System.Data.Entity.EntityState.Deleted;
                    db.SaveChanges();
                }
            }
        }