public ActionResult Edit(RentalApplication rentalapplication)
 {
     if (ModelState.IsValid)
     {
         UnitofWork.RentalApplicationRepository.Edit(rentalapplication);
         UnitofWork.Save();
         return RedirectToAction("Index");
     }
     return View(rentalapplication);
 }
 public ActionResult Create(RentalApplication rentalapplication)
 {
     if (ModelState.IsValid)
     {
         UnitofWork.RentalApplicationRepository.Add(rentalapplication);
         UnitofWork.Save();
         return RedirectToAction("Index");
     }
        // var errors = ModelState.Values.SelectMany(v => v.Errors);
     return View(rentalapplication);
 }
        public ActionResult Submit(RentalApplication rentalapplication)
        {
            //OVER HERE YOU HAVE TO
            //CHECK THAT AN APPLICATION EXIST
            //PROCESS TO AMAZONPAYPAL
            //YOU DON'T NEED MODEL VALIDATION

            //ALOS WHEN SUCCED
            //ADD ROW IN PAYMENT WITH DESCRIPTION OF THIS TRANSACTION

            //ALSO SEND EMAIL TO LISTER
            //SO HE OR SHE DOES BACKGROUND CHECKING AND ACCPET/DENY APPLICATION

            if (ModelState.IsValid)
            {
                UnitofWork.RentalApplicationRepository.Add(rentalapplication);
                UnitofWork.Save();
                return RedirectToAction("Index");
            }
            return View(rentalapplication);
        }
 public void InsertAgentPendingApplication(RentalApplication r, int agentId)
 {
     var apa = new AgentPendingApplication
     {
         FirstName = r.FirstName,
         LastName = r.LastName,
         MiddleName = r.MiddleName,
         SocialSecurityNumber = r.SocialSecurityNumber,
         DriverLicense = r.DriverLicense,
         Phone = r.Phone,
         CellPhone = r.CellPhone,
         EmailAddress = r.EmailAddress,
         CoSignerName = r.CoSignerName,
         CoSignerAddress = r.CoSignerAddress,
         CoSignerCity = r.CoSignerCity,
         CoSignerState = r.CoSignerState,
         CoSignerZipcode = r.CoSignerZipcode,
         CoSignerPhone = r.CoSignerPhone,
         CoSignerRelationShip = r.CoSignerRelationShip,
         CoSignerEmailAddress = r.CoSignerEmailAddress,
         OtherOccupant1Name = r.OtherOccupant1Name,
         IsOccupant1Adult = r.IsOccupant1Adult,
         RelationshipOccupant1ToApplicant = r.RelationshipOccupant1ToApplicant,
         OtherOccupant2Name = r.OtherOccupant2Name,
         IsOccupant2Adult = r.IsOccupant2Adult,
         RelationshipOccupant2ToApplicant = r.RelationshipOccupant2ToApplicant,
         OtherOccupant3Name = r.OtherOccupant3Name,
         IsOccupant3Adult = r.IsOccupant3Adult,
         RelationshipOccupant3ToApplicant = r.RelationshipOccupant3ToApplicant,
         OtherOccupant4Name = r.OtherOccupant4Name,
         IsOccupant4Adult = r.IsOccupant4Adult,
         RelationshipOccupant4ToApplicant = r.RelationshipOccupant4ToApplicant,
         EmployerName = r.EmployerName,
         Income = r.Income,
         WorkStartDate = r.WorkStartDate,
         WorkEndDate = r.WorkEndDate,
         EmployerAddress = r.EmployerAddress,
         EmployerCity = r.EmployerCity,
         EmployerState = r.EmployerState,
         EmployerZipcode = r.EmployerZipcode,
         EmployerPhone = r.EmployerPhone,
         EmployerFax = r.EmployerFax,
         CurrentLandloard = r.CurrentLandloard,
         CurrentLandLoardPhone = r.CurrentLandLoardPhone,
         CurrentLandLoardFax = r.CurrentLandLoardFax,
         CurrentAddress = r.CurrentAddress,
         CurrentAddressCity = r.CurrentAddressCity,
         CurrentAddressState = r.CurrentAddressState,
         CurrentAddressZip = r.CurrentAddressZip,
         Rent = r.Rent,
         CurrentRentStartDate = r.CurrentRentStartDate,
         CurrentRentEndDate = r.CurrentRentEndDate,
         PreviousLandloard = r.PreviousLandloard,
         PreviousLandLoardPhone = r.PreviousLandLoardPhone,
         PreviousLandLoardFax = r.PreviousLandLoardFax,
         PreviousAddress = r.PreviousAddress,
         PreviousAddressCity = r.PreviousAddressCity,
         PreviousAddressState = r.PreviousAddressState,
         PreviousAddressZip = r.PreviousAddressZip,
         PreviousRent = r.PreviousRent,
         PreviousRentStartDate = r.PreviousRentStartDate,
         PreviousRentEndDate = r.PreviousRentEndDate,
         EmergencyContactName = r.EmergencyContactName,
         EmergencyContactRelationShip = r.EmergencyContactRelationShip,
         EmergencyContactPhone = r.EmergencyContactPhone,
         EmergencyContactAddress = r.EmergencyContactAddress,
         EmergencyContactCity = r.EmergencyContactCity,
         EmergencyContactState = r.EmergencyContactState,
         EmergencyContactZipCode = r.EmergencyContactZipCode,
         Pets = r.Pets,
         PetsNumber = r.PetsNumber,
         Pet1Brand = r.Pet1Brand,
         Pet1Age = r.Pet1Age,
         Pet1Weight = r.Pet1Weight,
         Pet2Brand = r.Pet2Brand,
         Pet2Age = r.Pet2Age,
         Pet2Weight = r.Pet2Weight,
         Vehicle1Make = r.Vehicle1Make,
         Vehicle1Model = r.Vehicle1Model,
         Vehicle1Year = r.Vehicle1Year,
         Vehicle1Color = r.Vehicle1Color,
         Vehicle1LicensePlate = r.Vehicle1LicensePlate,
         Vehicle2Make = r.Vehicle2Make,
         Vehicle2Model = r.Vehicle2Model,
         Vehicle2Year = r.Vehicle2Year,
         Vehicle2Color = r.Vehicle2Color,
         Vehicle2LicensePlate = r.Vehicle2LicensePlate,
         Vehicle3Make = r.Vehicle3Make,
         Vehicle3Model = r.Vehicle3Model,
         Vehicle3Year = r.Vehicle3Year,
         Vehicle3Color = r.Vehicle3Color,
         Vehicle3LicensePlate = r.Vehicle3LicensePlate,
         Vehicle4Make = r.Vehicle4Make,
         Vehicle4Model = r.Vehicle4Model,
         Vehicle4Year = r.Vehicle4Year,
         Vehicle4Color = r.Vehicle4Color,
         Vehicle4LicensePlate = r.Vehicle4LicensePlate,
         Bankruptcy = r.Bankruptcy,
         LeaseDefaulted = r.LeaseDefaulted,
         RefusedtoPayRent = r.RefusedtoPayRent,
         EvictedFromRental = r.EvictedFromRental,
         ConvictedofFelony = r.ConvictedofFelony,
         TenantId = r.TenantId,
         AgentId = agentId
     };
     UnitofWork.AgentPendingApplicationRepository.Add(apa);
     UnitofWork.Save();
 }
        public void Create()
        {
            //Act
            var newRentalApplication = new RentalApplication {
                 ApplicationId = 4,
                 FirstName = null,
                 LastName = null,
                 MiddleName = null,
                 DateofBirth = new DateTime(),
                 SocialSecurityNumber = null,
                 DriverLicense = null,
                 Phone = null,
                 CellPhone = null,
                 EmailAddress = null,
                 CoSignerName = null,
                 CoSignerAddress = null,
                 CoSignerCity = null,
                 CoSignerState = null,
                 CoSignerZipcode = null,
                 CoSignerPhone = null,
                 CoSignerRelationShip = null,
                 CoSignerEmailAddress = null,
                 OtherOccupant1Name = null,
                 IsOccupant1Adult = new Boolean(),
                 RelationshipOccupant1ToApplicant = null,
                 OtherOccupant2Name = null,
                 IsOccupant2Adult = new Boolean(),
                 RelationshipOccupant2ToApplicant = null,
                 OtherOccupant3Name = null,
                 IsOccupant3Adult = new Boolean(),
                 RelationshipOccupant3ToApplicant = null,
                 OtherOccupant4Name = null,
                 IsOccupant4Adult = new Boolean(),
                 RelationshipOccupant4ToApplicant = null,
                 EmployerName = null,
                 Income = null,
                 WorkStartDate = new DateTime(),
                 WorkEndDate = new DateTime(),
                 EmployerAddress = null,
                 EmployerCity = null,
                 EmployerState = null,
                 EmployerZipcode = null,
                 EmployerPhone = null,
                 EmployerFax = null,
                 CurrentLandloard = null,
                 CurrentLandLoardPhone = null,
                 CurrentLandLoardFax = null,
                 CurrentAddress = null,
                 CurrentAddressCity = null,
                 CurrentAddressState = null,
                 CurrentAddressZip = null,
                 Rent = null,
                 CurrentRentStartDate = new DateTime(),
                 CurrentRentEndDate = new DateTime(),
                 PreviousLandloard = null,
                 PreviousLandLoardPhone = null,
                 PreviousLandLoardFax = null,
                 PreviousAddress = null,
                 PreviousAddressCity = null,
                 PreviousAddressState = null,
                 PreviousAddressZip = null,
                 PreviousRent = null,
                 PreviousRentStartDate = new DateTime(),
                 PreviousRentEndDate = new DateTime(),
                 EmergencyContactName = null,
                 EmergencyContactRelationShip = null,
                 EmergencyContactPhone = null,
                 EmergencyContactAddress = null,
                 EmergencyContactCity = null,
                 EmergencyContactState = null,
                 EmergencyContactZipCode = null,
                 Pets = new Boolean(),
                 PetsNumber = new Int32(),
                 Pet1Brand = null,
                 Pet1Age = new Int32(),
                 Pet1Weight = null,
                 Pet2Brand = null,
                 Pet2Age = new Int32(),
                 Pet2Weight = null,
                 Vehicle1Make = null,
                 Vehicle1Model = null,
                 Vehicle1Year = new Int32(),
                 Vehicle1Color = null,
                 Vehicle1LicensePlate = null,
                 Vehicle2Make = null,
                 Vehicle2Model = null,
                 Vehicle2Year = new Int32(),
                 Vehicle2Color = null,
                 Vehicle2LicensePlate = null,
                 Vehicle3Make = null,
                 Vehicle3Model = null,
                 Vehicle3Year = new Int32(),
                 Vehicle3Color = null,
                 Vehicle3LicensePlate = null,
                 Vehicle4Make = null,
                 Vehicle4Model = null,
                 Vehicle4Year = new Int32(),
                 Vehicle4Color = null,
                 Vehicle4LicensePlate = null,
                 Bankruptcy = new Boolean(),
                 LeaseDefaulted = new Boolean(),
                 RefusedtoPayRent = new Boolean(),
                 EvictedFromRental = new Boolean(),
                 ConvictedofFelony = new Boolean(),
                 TenantId = new Int32()
            };
            Controller.Create(newRentalApplication);
            var actual = Controller.Index();

            // Assert
            var viewResult = actual as ViewResult;
            if (viewResult == null) return;
            var data = viewResult.ViewData.Model as IList<RentalApplication>;
            if (data != null) Assert.AreEqual(4, data.Count);
        }
 /// <summary>
 /// TenantRentalApplicationHelper Instance
 /// </summary>
 /// <returns></returns>
 public void InsertOwnerPendingApplication(RentalApplication r, int ownerId)
 {
     TenantRentalApplicationHelper.InsertOwnerPendingApplication(r, ownerId);
 }
 public void InsertAgentPendingApplication(RentalApplication r, int agentId)
 {
     TenantRentalApplicationHelper.InsertAgentPendingApplication(r, agentId);
 }