Exemplo n.º 1
0
        public void UpdateCollateral_Failure()
        {
            // Act
            var updateCollateralFailure = new CollateralViewModel
            {
                ParentContactID         = 0,
                ContactID               = -1,
                ContactTypeID           = 4,
                FirstName               = "firstName1",
                LastName                = "lastName1",
                LivingWithClientStatus  = false,
                ReceiveCorrespondenceID = 1,
                ContactRelationshipID   = 2,
                RelationshipTypeID      = 3,
                IsActive                = true,
                ModifiedBy              = 5,
                ModifiedOn              = DateTime.Now,
                ForceRollback           = true
            };

            var response = controller.UpdateCollateral(updateCollateralFailure);

            // Assert
            Assert.IsTrue(response.RowAffected == 0, "Collateral updated.");
        }
        /// <summary>
        /// To update collateral for contact
        /// </summary>
        /// <param name="collateral"></param>
        /// <returns></returns>
        public Response <CollateralViewModel> UpdateCollateral(CollateralViewModel collateral)
        {
            const string apiUrl   = baseRoute + "UpdateCollateral";
            var          response = communicationManager.Put <CollateralModel, Response <CollateralModel> >(collateral.ToModel(), apiUrl);

            return(response.ToViewModel());
        }
Exemplo n.º 3
0
        public void AddCollateral_Failure()
        {
            // Act
            var contactAddressModel = new List <ContactAddressModel>();

            contactAddressModel.Add(new ContactAddressModel {
                AddressID = 1, AddressTypeID = 2, Line1 = "Address Line1", Line2 = "AddressLine2", City = "Colorado", County = 1, StateProvince = 2, Zip = "zipCode"
            });

            var contactPhoneModel = new List <ContactPhoneModel>();

            contactPhoneModel.Add(new ContactPhoneModel {
                ContactPhoneID = 1, PhoneID = 1, PhoneTypeID = 2, PhonePermissionID = 3, Number = "9876458125"
            });

            var contactEmailModel = new List <ContactEmailModel>();

            contactEmailModel.Add(new ContactEmailModel {
                Email = "*****@*****.**"
            });

            var addCollateralFailure = new CollateralViewModel
            {
                ParentContactID         = -1,
                ContactID               = -1,
                ContactTypeID           = -1,
                DriverLicense           = "driverLicense",
                DriverLicenseStateID    = 10,
                AlternateID             = "alternateID",
                ClientIdentifierTypeID  = 6,
                ContactRelationshipID   = 1,
                LivingWithClientStatus  = true,
                ReceiveCorrespondenceID = 1,
                FirstName               = "firstName11",
                LastName           = "lastName11",
                GenderID           = 1,
                DOB                = DateTime.Now,
                SuffixID           = 2,
                RelationshipTypeID = 2,
                Addresses          = contactAddressModel,
                Phones             = contactPhoneModel,
                Emails             = contactEmailModel,
                IsActive           = true,
                ModifiedBy         = 5,
                ModifiedOn         = DateTime.Now,
                ForceRollback      = true
            };

            var response = controller.AddCollateral(addCollateralFailure);

            // Assert
            Assert.IsTrue(response.ResultCode != 0);
            Assert.IsTrue(response.RowAffected == 0, "Collateral created.");
        }
        /// <summary>
        /// Converting CollateralViewModel to CollateralModel
        /// </summary>
        /// <param name="model">model</param>
        /// <returns></returns>
        public static CollateralModel ToModel(this CollateralViewModel model)
        {
            if (model == null)
            {
                return(null);
            }

            var entity = new CollateralModel
            {
                ParentContactID          = model.ParentContactID,
                ContactID                = model.ContactID,
                FirstName                = model.FirstName,
                LastName                 = model.LastName,
                Middle                   = model.Middle,
                SuffixID                 = model.SuffixID,
                DOB                      = model.DOB,
                GenderID                 = model.GenderID,
                Addresses                = model.Addresses,
                Emails                   = model.Emails,
                Phones                   = model.Phones,
                ClientAlternateIDs       = model.ClientAlternateIDs,
                RelationshipTypeID       = model.RelationshipTypeID,
                ContactTypeID            = model.ContactTypeID,
                ContactRelationshipID    = model.ContactRelationshipID,
                LivingWithClientStatus   = model.LivingWithClientStatus,
                ReceiveCorrespondenceID  = model.ReceiveCorrespondenceID,
                SSN                      = model.SSN,
                DriverLicense            = model.DriverLicense,
                DriverLicenseStateID     = model.DriverLicenseStateID,
                IsActive                 = model.IsActive,
                ModifiedBy               = model.ModifiedBy,
                ModifiedOn               = model.ModifiedOn,
                ForceRollback            = model.ForceRollback,
                EmergencyContact         = model.EmergencyContact,
                CopyContactAddress       = model.CopyContactAddress,
                EmploymentStatusID       = model.EmploymentStatusID,
                EducationStatusID        = model.EducationStatusID,
                SchoolAttended           = model.SchoolAttended,
                SchoolBeginDate          = model.SchoolBeginDate,
                SchoolEndDate            = model.SchoolEndDate,
                VeteranStatusID          = model.VeteranStatusID,
                RelationshipGroupID      = model.RelationshipGroupID,
                OtherRelationship        = model.OtherRelationship,
                IsPolicyHolder           = model.IsPolicyHolder,
                CollateralEffectiveDate  = model.CollateralEffectiveDate,
                CollateralExpirationDate = model.CollateralExpirationDate,
                Relationships            = model.Relationships,
                CollateralTypes          = model.CollateralTypes
            };

            return(entity);
        }
Exemplo n.º 5
0
 public Response <CollateralViewModel> UpdateCollateral(CollateralViewModel collateral)
 {
     return(collateralRepository.UpdateCollateral(collateral));
 }