コード例 #1
0
        //Add method - or Create from CRUD
        public bool AddCustomer(KomodoCustomer customer)
        {
            int startingCount = _customerDirectory.Count;

            _customerDirectory.Add(customer);

            bool wasAdded = startingCount < _customerDirectory.Count ? true : false;

            return(wasAdded);
        }
コード例 #2
0
        //Update Customer Information
        public bool UpdateCustomerInformation(int id, string lastName, int age)
        {
            //first get customer by id
            KomodoCustomer customer = GetKomodoCustomerById(id);

            if (customer != null)
            {
                customer.LastName = lastName;
                customer.Age      = age;
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
        //Delete method
        public bool DeleteCustomerInformation(KomodoCustomer customer)
        {
            bool isDeleted = _customerDirectory.Remove(customer);

            return(isDeleted);
        }