コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: nolsen7187/MSSE_Week2
        public void AddCustomerandSaleHeader()
        {
            FFREntities ffrDb = new FFREntities();

            Customer customer = new Customer();
            customer.CustomerId = 1;
            customer.FirstName = "Nick";
            customer.LastName = "Olsen";
            customer.City = "Parker";
            customer.State = "CO";
            customer.Zip = "80134";
            //Need to Add Street Name and Suite Fields
            customer.Address = customer.FirstName + " " + customer.LastName + "11321 Lovage Way " + customer.City + ", " + customer.State + " " + customer.Zip;
            customer.Phone = "3037181336";
            customer.Email = "*****@*****.**";

            ffrDb.Customers.Add(customer);
            ffrDb.SaveChanges();

            SalesHeader salesHeader = new SalesHeader();

            salesHeader.CustomerId = customer.CustomerId;
            salesHeader.SalesStatus = "Open";
            salesHeader.OrderSalesBalance = 50;
            salesHeader.OrderTaxAmount = 5;
            salesHeader.OrderTotal = salesHeader.OrderSalesBalance + salesHeader.OrderTaxAmount;

            ffrDb.SalesHeaders.Add(salesHeader);
            ffrDb.SaveChanges();
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: nolsen7187/MSSE680_Week3
        public void CreateCustomerUsingRepository()
        {
            var customerRepo = new DataRepository<Customer>();

            Customer createCustomer = new Customer();
            createCustomer.FirstName = "Jackie";
            createCustomer.LastName = "Olsen";
            createCustomer.Address = "11320 Lovage Way";
            createCustomer.City = "Parker";
            createCustomer.State = "CO";
            createCustomer.Zip = "80134";
            createCustomer.Phone = "303-949-2695";
            createCustomer.Email = "*****@*****.**";

            customerRepo.Create(createCustomer);
        }