private List <CharacterChoices> GetAllCharacters()
        {
            List <CharacterChoices> characters = null;

            FileIoStatus = FileIoMessage.None;
            try
            {
                using (CharacterRepo cRepo = new CharacterRepo())
                {
                    characters = cRepo.GetAll() as List <CharacterChoices>;
                };
                if (characters != null)
                {
                    FileIoStatus = FileIoMessage.Complete;
                }
                else
                {
                    FileIoStatus = FileIoMessage.NoRecordsFound;
                }
            }
            catch (Exception)
            {
                FileIoStatus = FileIoMessage.FileAccessError;
            }
            return(characters);
        }
        private CharacterChoices GetCharacter(int id)
        {
            CharacterChoices character = null;

            FileIoStatus = FileIoMessage.None;
            try
            {
                using (CharacterRepo cRepo = new CharacterRepo())
                {
                    character = cRepo.GetById(id);
                };
                if (character != null)
                {
                    FileIoStatus = FileIoMessage.Complete;
                }
                else
                {
                    FileIoStatus = FileIoMessage.RecordNotFound;
                }
            }
            catch (Exception)
            {
                FileIoStatus = FileIoMessage.FileAccessError;
            }
            return(character);
        }
 public void AddCharacter(CharacterChoices character)
 {
     try
     {
         if (character != null)
         {
             using (CharacterRepo cRepo = new CharacterRepo())
             {
                 cRepo.Add(character);
             };
             FileIoStatus = FileIoMessage.Complete;
         }
     }
     catch (Exception)
     {
         FileIoStatus = FileIoMessage.FileAccessError;
     }
 }
 public void DeleteCharacter(int id)
 {
     try
     {
         if (GetCharacter(id) != null)
         {
             using (CharacterRepo cRepo = new CharacterRepo())
             {
                 cRepo.Delete(id);
             }
             FileIoStatus = FileIoMessage.Complete;
         }
     }
     catch (Exception)
     {
         FileIoStatus = FileIoMessage.FileAccessError;
     }
 }
 public void UpdateCharacter(CharacterChoices updatedCharacter)
 {
     try
     {
         if (GetCharacter(updatedCharacter.Id) != null)
         {
             using (CharacterRepo cRepo = new CharacterRepo())
             {
                 cRepo.Update(updatedCharacter);
             }
             FileIoStatus = FileIoMessage.Complete;
         }
         else
         {
             FileIoStatus = FileIoMessage.RecordNotFound;
         }
     }
     catch (Exception)
     {
         FileIoStatus = FileIoMessage.FileAccessError;
     }
 }