コード例 #1
0
        public void UpdateAccount(DalAccount account)
        {
            using (AccountContext db = new AccountContext())
            {
                DalAccount dbAccount = db.Accounts.Find(account.Id);

                foreach (var prop in account.GetType().GetProperties())
                {
                    prop.SetValue(dbAccount, (prop.GetValue(account)));
                }

                db.SaveChanges();
            }
        }