Ejemplo n.º 1
0
        public int InsertAccount(Account account)
        {
            int insertedRows;

            context.Accounts.Add(account);
            insertedRows = context.SaveChanges();

            return insertedRows;
        }
Ejemplo n.º 2
0
        public int UpdateAccount(Account account)
        {
            int updatedRows = 0;
            Account dbAccount = context.Accounts.Find(account.Id);

            if (dbAccount != null)
            {
                dbAccount.IsActive = account.IsActive;
                dbAccount.AccountTypeId = account.AccountTypeId;
                dbAccount.Name = account.Name;
                dbAccount.URL = account.URL;
                updatedRows = context.SaveChanges();
            }

            return updatedRows;
        }