Exemple #1
0
        public void Seed()
        {
            _repoCustomer = new CustomerTracker_Repo();
            CustomerTracker cust1 = new CustomerTracker(
                "Henry",
                1,
                33,
                new DateTime(2006, 10, 10)
                );

            _repoCustomer = new CustomerTracker_Repo();
            CustomerTracker cust2 = new CustomerTracker(
                "Roberts",
                2,
                43,
                new DateTime(2020, 10, 10)
                );

            _repoCustomer = new CustomerTracker_Repo();
            CustomerTracker cust3 = new CustomerTracker(
                "Phillips",
                3,
                53,
                new DateTime(2021, 1, 10)
                );

            _repoCustomer.AddCustomerToDirectory(cust1);
            _repoCustomer.AddCustomerToDirectory(cust2);
            _repoCustomer.AddCustomerToDirectory(cust3);

            _contentCustomer = new CustomerTracker();

            Console.WriteLine("Names : " + _repoCustomer.GetContents());
        }
Exemple #2
0
        public void UpdateContent()
        {
            CustomerTracker updateCustomer = new CustomerTracker();
            bool            wasUpdated     = _repo.UpdateContent("Unforgiven", updateMovie);

            Assert.IsTrue(wasUpdated);
            CustomerTracker updatedMovie = _repo.GetContentByTitle("Unforgiven");

            Console.WriteLine(updateMovie.Desc);
        }
Exemple #3
0
        private readonly List <CustomerTracker> _directory //= new List<CustomerTracker>();
        // do CRUD

        public bool AddCustomerToDirectory(CustomerTracker content)
        {
            int startCount = _directory.Count;

            _directory.Add(content);

            bool WasAdded = (_directory.Count > startCount);

            return(WasAdded);
        }
Exemple #4
0
        public bool UpdateContent(int id, CustomerTracker newContent)
        {
            CustomerTracker oldContent = GetContentById(id);

            if (oldContent != null)
            {
                oldContent.LastName     = newContent.LastName;
                oldContent.Age          = newContent.Age;
                oldContent.DateEnrolled = newContent.DateEnrolled;

                return(true);
            }
            return(false);
        }
Exemple #5
0
 public void TestGetTitle()
 {
     CustomerTracker search = _repoCustomer.GetContentById(1);
 }
Exemple #6
0
        public bool DeleteContent(int id)
        {
            CustomerTracker ToDelete = GetContentById(id);

            return(_directory.Remove(ToDelete));
        }