Example #1
0
        // Business Logic pass through code to Select all Owners
        public List <OwnersEntity> SelectAllOwners()
        {
            var returnedEntities = new List <OwnersEntity>();

            try
            {
                using (var repository = new OwnersRepository())
                {
                    // HERE A CALCULATION CAN BE ADDED AS A COLUMN IN SelectAll function
                    foreach (var entity in repository.SelectAll())
                    {
                        entity.PetYears = GetPetYears(entity.PetAge);
                        returnedEntities.Add(entity);
                    }
                }

                return(returnedEntities);
            }
            catch (Exception ex)
            {
                //Log exception error
                _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);

                throw new Exception("BusinessLogic:OwnersBusiness::SelectAllOwners::Error occured.", ex);
            }
        }