示例#1
0
        /// <summary>
        /// Gets Customer based on CustomerID.
        /// </summary>
        /// <param name="searchCustomerID">Represents CustomerID to search.</param>
        /// <returns>Returns Customer object.</returns>
        public override Customer GetCustomerByCustomerIDDAL(Guid searchCustomerID)
        {
            Customer matchingCustomer = null;

            try
            {
                //Find Customer based on searchCustomerID
                matchingCustomer = CustomerList.Find(
                    (item) => { return(item.CustomerID == searchCustomerID); }
                    );
            }
            catch (System.Exception)
            {
                throw;
            }
            return(matchingCustomer);
        }
示例#2
0
        /// <summary>
        /// Gets Customer based on Email and Password.
        /// </summary>
        /// <param name="email">Represents Customer's Email Address.</param>
        /// <param name="password">Represents Customer's Password.</param>
        /// <returns>Returns Customer object.</returns>
        public override Customer GetCustomerByEmailAndPasswordDAL(string email, string password)
        {
            Customer matchingCustomer = null;

            try
            {
                //Find Customer based on Email and Password
                matchingCustomer = CustomerList.Find(
                    (item) => { return(item.Email.Equals(email) && item.Password.Equals(password)); }
                    );
            }
            catch (System.Exception)
            {
                throw;
            }
            return(matchingCustomer);
        }
示例#3
0
        /// <summary>
        /// Deletes Customer based on CustomerID.
        /// </summary>
        /// <param name="deleteCustomerID">Represents CustomerID to delete.</param>
        /// <returns>Determinates whether the existing Customer is updated.</returns>
        public override bool DeleteCustomerDAL(Guid deleteCustomerID)
        {
            bool CustomerDeleted = false;

            try
            {
                //Find Customer based on searchCustomerID
                Customer matchingCustomer = CustomerList.Find(
                    (item) => { return(item.CustomerID == deleteCustomerID); }
                    );

                if (matchingCustomer != null)
                {
                    //Delete Customer from the collection
                    CustomerList.Remove(matchingCustomer);
                    CustomerDeleted = true;
                }
            }
            catch (System.Exception)
            {
                throw;
            }
            return(CustomerDeleted);
        }