Exemple #1
0
 /// <summary>
 /// Erstelle ein neues Erloeskonte
 /// </summary>
 /// <param name="CustomerId">Kundenid</param>
 /// <param name="AccountNumber">Kontonummer</param>
 /// <param name="dbContext">Datenbank Kontext</param>
 /// <returns>Erloeskonto</returns>
 public static Accounts CreateAccount(int? CustomerId, string AccountNumber, DataClasses1DataContext dbContext)
 {
     if (dbContext.Accounts.Any(q => q.CustomerId == CustomerId && q.AccountNumber == AccountNumber))
        {
        throw new Exception("Für diesen Kunden ist bereits dieses Konto eingetragen");
        }
        var account = new Accounts
        {
        AccountNumber = AccountNumber,
        CustomerId = CustomerId
        };
        dbContext.Accounts.InsertOnSubmit(account);
        dbContext.SubmitChanges();
        return account;
 }
 partial void UpdateAccounts(Accounts instance);
 partial void DeleteAccounts(Accounts instance);
 partial void InsertAccounts(Accounts instance);