Exemplo n.º 1
0
        public ActionResult RegistrationCustomer(AccountCustomer accountCustomer)
        {
            accountCustomer.Account.AccountType = AccountType.Customer;
            Account  regAccount  = accountCustomer.Account;
            Customer regCustomer = accountCustomer.Customer;

            return(RedirectToAction("Login", "Home"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            AccountCustomer accountCustomer = await db.AccountCustomers.FindAsync(id);

            db.AccountCustomers.Remove(accountCustomer);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Edit([Bind(Include = "AccountID,CustomerID,ID")] AccountCustomer accountCustomer)
        {
            if (ModelState.IsValid)
            {
                db.Entry(accountCustomer).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.AccountID  = new SelectList(db.BankAccounts, "AccountID", "AccountCurrency", accountCustomer.AccountID);
            ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustomerName", accountCustomer.CustomerID);
            return(View(accountCustomer));
        }
Exemplo n.º 4
0
        // GET: AccountCustomers/Details/5
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AccountCustomer accountCustomer = await db.AccountCustomers.FindAsync(id);

            if (accountCustomer == null)
            {
                return(HttpNotFound());
            }
            return(View(accountCustomer));
        }
Exemplo n.º 5
0
        // GET: AccountCustomers/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AccountCustomer accountCustomer = await db.AccountCustomers.FindAsync(id);

            if (accountCustomer == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AccountID  = new SelectList(db.BankAccounts, "AccountID", "AccountCurrency", accountCustomer.AccountID);
            ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustomerName", accountCustomer.CustomerID);
            return(View(accountCustomer));
        }
Exemplo n.º 6
0
        public IActionResult Profile(AccountCustomer account)
        {
            try
            {
                var loginedAccount = ocmde.AccountCustomer.SingleOrDefault(a => a.Email.Equals(HttpContext.Session.GetString("email_customer")));

                var currentAccount = ocmde.AccountCustomer.SingleOrDefault(a => a.Id == account.Id);

                if (account.Email != null && account.Email.Length > 0 && loginedAccount.Email != account.Email)
                {
                    if (Exists(account.Email))
                    {
                        ModelState.AddModelError("username", sharedLocalizer["Username_already_exists"]);
                    }
                }

                if (account.Password != null && account.Password.Length != 0 && !PasswordHelper.IsValidPassword(account.Password))
                {
                    ModelState.AddModelError("Password", sharedLocalizer["Password_validate_message"]);
                }

                if (ModelState.IsValid)
                {
                    if (account.Password != null && account.Password.Length != 0)
                    {
                        currentAccount.Password = BCrypt.Net.BCrypt.HashPassword(account.Password);
                    }
                    currentAccount.Email    = account.Email;
                    currentAccount.FullName = account.FullName;
                    currentAccount.Phone    = account.Phone;
                    //currentAccount.Username = account.Username;
                    ocmde.SaveChanges();
                    HttpContext.Session.SetString("email_customer", account.Email);
                    return(RedirectToAction("Profile", "Login"));
                }
                else
                {
                    return(View("Profile", account));
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
Exemplo n.º 7
0
        public IActionResult Register(AccountCustomer account)
        {
            try
            {
                if (account.Email != null && account.Email.Length > 0)
                {
                    if (Exists(account.Email))
                    {
                        ModelState.AddModelError("username", sharedLocalizer["Username_already_exists"]);
                    }
                }

                if (account.Password != null && account.Password.Length != 0 && !PasswordHelper.IsValidPassword(account.Password))
                {
                    ModelState.AddModelError("Password", sharedLocalizer["Password_validate_message"]);
                }

                if (ModelState.IsValid)
                {
                    //account.IsAdmin = false;
                    account.Status   = true;
                    account.Password = BCrypt.Net.BCrypt.HashPassword(account.Password);
                    ocmde.AccountCustomer.Add(account);
                    ocmde.SaveChanges();
                    return(RedirectToAction("Index", "Login", new { Area = "customerpanel" }));
                }
                else
                {
                    return(View("Register", account));
                }
            }
            catch (Exception e)
            {
                throw;
            }
        }
Exemplo n.º 8
0
 public Withdraw(AccountCustomer account)
 {
     this.account = account;
 }
Exemplo n.º 9
0
 public Account(int id, AccountCustomer customer, double balance) : this(id, customer) => this.balance = balance;
Exemplo n.º 10
0
 /// <summary>
 /// Retains the transfer service information
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="receiver"></param>
 public void UpdateTransfer(AccountCustomer sender, AccountCustomer receiver)
 {
     PriceList.Transfer.TransferMoney(sender, receiver,
                                      this.AmountTransfer);
 }
Exemplo n.º 11
0
 public Deposit(AccountCustomer account)
 {
     this.account = account;
 }