Exemple #1
0
        /// <summary>
        /// Returns one Person with the ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns>The found Person</returns>
        public PersonData.Person FindPerson(int id)
        {
            try
            {
                var tempPerson = RepositoryPerson.FindAll().FirstOrDefault(x => x.Id == id);

                if (tempPerson != null)
                {
                    var result = RepositoryCourse.CompletedCourses <Course>(id);
                    tempPerson.CompletedCourse    = result.Item1;
                    tempPerson.NotCompletedCourse = result.Item2;
                    tempPerson.documents          = RepositoryDocument.GetDocuments <PersonData.Person>(id);
                    tempPerson.Communications     = RepositoryCommunication.GetCommunications <PersonData.Person>(id);

                    return(tempPerson);
                }
                else
                {
                    throw new PersonException($"Person with ID {id} does not exist!");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }