Esempio n. 1
0
        public PetKennelInfoVM(int petId)
        {
            petKennelClub             = new PetKennelClub();
            _id                       = new ValidatableObject <int>();
            _petId                    = new ValidatableObject <int>();
            _kennelClubName           = new ValidatableObject <string>();
            _kennelRegistrationNumber = new ValidatableObject <string>();
            _kennelContactNumber      = new ValidatableObject <string>();
            _petId.Value              = petId;
            AddValidations();
            PetAdditionalInfoRepository petAdditionalInfoRepository = new PetAdditionalInfoRepository();

            var petKennelInfo = petAdditionalInfoRepository.GetPetKennelInfoAsync(_petId.Value);

            if (petKennelInfo != null)
            {
                _kennelClubName.Value           = petKennelInfo.KennelClubName;
                _kennelRegistrationNumber.Value = petKennelInfo.KennelRegistrationNumber;
                _kennelContactNumber.Value      = petKennelInfo.KennelContactNumber;
                _id.Value = petKennelInfo.Id;
            }
        }
Esempio n. 2
0
        public bool AddPetKennelInfoAsync(PetKennelClub petKennelClub)
        {
            App.Logger.Info(this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + " - Started");
            bool isSuccess = false;

            try
            {
                var inserted = _db.InsertAsync(petKennelClub).Result;
                if (inserted > 0)
                {
                    isSuccess = true;
                }
                return(isSuccess);
            }
            catch (Exception ex)
            {
                App.Logger.Error(this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + " " + ex.Message);
                throw ex;
            }
            finally
            {
                App.Logger.Info(this.GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod().Name + " - Completed");
            }
        }