Пример #1
0
        // Log in to customer account
        public void LogInCustomer(ICustomerRepository customer)
        {
            string username = "";
            string password = "";

            Console.WriteLine("Please provide first name: ");
            username = Console.ReadLine();

            Console.WriteLine("Please provide id: ");
            password = Console.ReadLine();

            customerAccount = customer.GetCustomer(username, int.Parse(password));
            Console.WriteLine($"Welcome {customerAccount.FirstName}");
            _loggedIn = true;
        }
Пример #2
0
        public IActionResult OnGet(int?id)
        {
            if (id.HasValue)
            {
                Customer = customerData.GetCustomerById(id.Value);
                if (Customer == null)
                {
                    RedirectToPage("./NotFound");
                }
            }
            else
            {
                Customer = new Core.Customer();
            }
            var membershis = membershipData.GetMemberships().ToList().Select(m => new { Id = m.Id, Display = m.MembershipType });

            Memberships = new SelectList(membershis, "Id", "Display");
            return(Page());
        }
Пример #3
0
        public void CanSaveCustomer()
        {
            using(var session = FactoryProvider.Factory.OpenSession())
                using (var transaction = session.BeginTransaction())
                {
                    try
                    {
                        var customer = new Customer();
                        customer.CommercialName = "Franio";
                        customer.TaxId = "12312";
                        session.Save(customer);
                        transaction.Commit();
                        Assert.Greater(customer.Id, 0);
                    }catch
                    {
                        transaction.Rollback();

                    }
            }
        }
Пример #4
0
 // Log out from customer account
 public void LogOutCustomer(ICustomerRepository customer)
 {
     customerAccount = null;
     _loggedIn       = false;
     Console.WriteLine("You have logged out of your account.\n");
 }