Exemple #1
0
        // Business Logic pass through code to Select an Owner by ID
        public OwnersEntity SelectOwnerById(int id)
        {
            try
            {
                OwnersEntity returnedEntity;
                using (var repository = new OwnersRepository())
                {
                    returnedEntity = repository.SelectById(id);
                    if (returnedEntity != null)
                    {
                        // Business Calculation function called from here
                        returnedEntity.PetYears = GetPetYears(returnedEntity.PetAge);
                    }
                }

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

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