Esempio n. 1
0
        //ContextCustomer
        public StoreApp.Logic.Customer ContextCustomerToLogicCustomer(Entities.Customer cust)
        {
            StoreApp.Logic.Customer LogicCustomer = new StoreApp.Logic.Customer();

            LogicCustomer.customerAddress.street = cust.Street;
            LogicCustomer.customerAddress.city   = cust.City;
            LogicCustomer.customerAddress.state  = cust.State;
            LogicCustomer.customerAddress.zip    = cust.Zip;

            LogicCustomer.customerId = cust.CustomerId;
            LogicCustomer.firstName  = cust.FirstName;
            LogicCustomer.lastName   = cust.LastName;
            LogicCustomer.userName   = cust.Username;

            return(LogicCustomer);
        }
 public Logic.Customer GetCustomerDataByName(string name, StoreAppContext context)
 {
     //List All Customer Info Their Last Name or First Name is Correct
     try
     {
         foreach (StoreApp.Library.Entities.Customer cust in context.Customer)
         {
             if (cust.FirstName == name || cust.LastName == name)
             {
                 StoreApp.Logic.Customer matched = parser.ContextCustomerToLogicCustomer(cust);
                 return(matched);
             }
         }
         return(null);
     }
     catch (Exception e)
     {
         Console.WriteLine("Cannot Connect To Database" + e.Message);
         return(null);
     }
 }