Beispiel #1
0
        public ActionResult Index(IFormCollection collection)
        {
            if (collection != null)
            {
                IBSRepository rep = new BSRepository();

                UserLogin login = rep.GetUserLoginInfo(collection["LoginName"].ToString());

                if (login != null && login.Password == collection["Password"].ToString())
                {
                    return(RedirectToAction("Index", "BankTransaction", new { loginName = login.LoginName }));
                }
                else
                {
                    return(View());
                }
            }
            else
            {
                return(View());
            }
        }
Beispiel #2
0
        public ActionResult CreateUserLogin(IFormCollection collection)
        {
            if (collection != null)
            {
                IBSRepository rep = new BSRepository();

                BankAccount acct = new BankAccount()
                {
                    LoginName     = collection["LoginName"].ToString(),
                    Password      = collection["Password"].ToString(),
                    AccountNumber = collection["AccountNumber"].ToString(),
                    Balance       = Convert.ToDouble(collection["Balance"]),
                    CreatedDate   = Convert.ToDateTime(collection["CreatedDate"])
                };

                //Check if LoginName exists in database
                UserLogin login = rep.GetUserLoginInfo(acct.LoginName);

                if (login != null)
                {
                    ViewBag.Message = "Login Name already exists in database. Please modify them.";

                    return(View(acct));
                }
                else
                {
                    rep.InsertNewBankAccount(acct, "Open New Account");

                    return(RedirectToAction("Index", "UserLogin", new { loginName = acct.LoginName }));
                }
            }
            else
            {
                return(View());
            }
        }