/// <summary>
        /// The purpose of this method is to search the db to return a model of the customer object given two strings as names
        /// </summary>
        /// <param name="search">Two strings a first and a last name</param>
        /// <returns>A customer object</returns>
        public IEnumerable <Domain.Models.Customer> FindCustomerByName(string[] search)
        {
            // Search the db and if someone is found assign it if no one was found assign null
            List <Entities.CustomerEntity> dbCustomer = _context.Customers.Where(c => (c.FirstName == search[0] && c.LastName == search[1])).ToList();

            // if it is null exit the method and return null
            if (dbCustomer == null)
            {
                return(new List <Domain.Models.Customer>());
            }

            List <Domain.Models.Customer> m_customers = new List <Domain.Models.Customer>();

            foreach (Entities.CustomerEntity customer in dbCustomer)
            {
                m_customers.Add(MapperCustomer.Map(customer));
            }

            return(m_customers);
        }
        /// <summary>
        /// Add a new Customer from Models to Database.
        /// </summary>
        /// <param name="customer"> This is the new Model to be put into the database. It only has a firstname and last name.</param>
        public void AddACustomer(Domain.Models.Customer customer)
        {
            // Create the Entity item to be put into the database
            Entities.CustomerEntity entity;

            // Since the database handles the ID setting with identity, we only need to assign the new entity the firstname and the lastname
            // Maybe in the future we could add a way to change the location, but for now the database sets the location to the default 1.
            entity = MapperCustomer.Map(customer);

            // Add the new entity to the context to send over to the database
            _context.Add(entity);
            Save();

            // Create their shopping cart
            Entities.ShoppingcartEntity shoppingcartEntity = new Entities.ShoppingcartEntity
            {
                CustomerId = entity.Id
            };
            _context.Add(shoppingcartEntity);
            // I am using the aproach of sending the data over after each change instead of having a universal save button
            Save();
        }
 public void Add(Customer genericType)
 {
     context.DBCustomers.Add(mapperCustomer.Map(genericType, context));
     context.SaveChanges();
 }