Пример #1
0
        public static void AddUser(CustomerRegisterClass NewCustomer)
        {
            var s = new ServicesContext();

            BankAccountDetails bank = new BankAccountDetails();

            bank.BankName      = NewCustomer.BankName;
            bank.AccountNumber = NewCustomer.BankAccNumber;
            bank.Balance       = 1000.00m;
            s.BankAccounts.Add(bank);

            User UserObj = new User();

            UserObj.Username = NewCustomer.Username;
            UserObj.Password = NewCustomer.Password;
            UserObj.Type     = "CUSTOMER";
            s.Users.Add(UserObj);

            CustomerDetails customer = new CustomerDetails();

            customer.Contact  = NewCustomer.Contact;
            customer.UserId   = UserObj.Id;
            customer.Location = NewCustomer.Location;
            customer.BankFK   = bank.Id;
            s.Customers.Add(customer);

            s.SaveChanges();
        }
Пример #2
0
 public ActionResult customer(CustomerRegisterClass dad)
 {
     if (ModelState.IsValid)
     {
         Data.AddUser(dad);
         return(Redirect("~/Login/Login"));
     }
     return(View());
 }