Example #1
0
        public void GetEveryPersonFromDatabase_GetAllPeople_IsTrue()
        {
            // Arrange
            _persons = new List <PeopleDto>();

            // Act
            _persons = _personData.GetAllPeople();

            // Assert
            Assert.IsTrue(_persons.Count > 0);
        }
Example #2
0
        // Get all Servers and populate as dropdown list items
        public async Task <List <SelectListItem> > GetAllServers()
        {
            var persons = await _people.GetAllPeople();

            List <SelectListItem> list = new List <SelectListItem>();

            foreach (var person in persons)
            {
                list.Add(new SelectListItem
                {
                    Text  = person.FullName,
                    Value = person.Id.ToString()
                });
            }

            return(list);
        }
        // View all employees as as list
        public async Task <IActionResult> ViewPersons()
        {
            var results = await _data.GetAllPeople();

            List <PersonDisplayModel> allEmployees = new List <PersonDisplayModel>();

            foreach (var employee in results)
            {
                allEmployees.Add(new PersonDisplayModel
                {
                    Id              = employee.Id,
                    EmployeeID      = employee.EmployeeID,
                    FirstName       = employee.FirstName,
                    LastName        = employee.LastName,
                    EmailAddress    = employee.EmailAddress,
                    CellPhoneNumber = employee.CellPhoneNumber
                });
            }

            return(View(allEmployees));
        }