コード例 #1
0
        /// <summary>
        /// Adds a new account to the repository.
        /// </summary>
        /// <param name="account">New account.</param>
        /// <exception cref="StorageException">
        /// It is thrown in the event of a storage error.
        /// </exception>
        public void AddAccount(AccountDal account)
        {
            if (ReferenceEquals(account, null))
            {
                throw new ArgumentNullException(nameof(account));
            }

            using (var context = new BankAccountContext())
            {
                context.Accounts.Add(account.ToAccountEF());
                context.SaveChanges();
            }
        }