Пример #1
0
        public static AccountClass Login(string email, string password)
        {
            CustomerClass customer     = null;
            AccountClass  customerAcct = null;

            foreach (var user in BankdatasClass.Customers)
            {
                if (user.Email == email && user.Password == password)
                {
                    customer = user;
                }
            }

            if (customer == null)
            {
                return(null);
            }
            else
            {
                foreach (var account in BankdatasClass.Accounts)
                {
                    if (account.OwnerId == customer.Id)
                    {
                        customerAcct = account;
                    }
                }

                return(customerAcct);
            }
        }
Пример #2
0
        public static AccountClass Register(string name, string email, string password, int acctype)
        {
            AccountClass  account  = null;
            CustomerClass customer = null;

            if (string.IsNullOrWhiteSpace(name) ||
                string.IsNullOrWhiteSpace(email) ||
                string.IsNullOrWhiteSpace(password)
                )
            {
                return(account);
            }



            customer = new CustomerClass(name, email, password);
            account  = new AccountClass(customer.Id, acctype);

            BankdatasClass.Customers.Add(customer);
            BankdatasClass.Accounts.Add(account);
            return(account);
        }