Ejemplo n.º 1
0
        public bool CreateAccount(int userId, out Account account)
        {
            account = new Account();
            string message = "";
            Random rnd     = new Random();

            if (userId == 0 || userId < 0)
            {
                throw new Exception("Пользователь не существует!");
            }
            else if (servicesUser.IsExistUser(userId))
            {
                account.UserId = userId;
                account.IBAN   = "KZ" + rnd.Next(1, 100);


                if (db.Create <Account>(account, out message))
                {
                    return(true);
                }

                else
                {
                    throw new Exception(message);
                }
            }

            return(false);
        }