Example #1
0
        public RiderViewModel()
        {
            //rider = new Rider();
            individual = new Individual();


            contact = new Contact();

            contact.address = new Address();

            contact.Email = new Email();

            contact.phoneNumber = new PhoneNumber();

            occupation = new RiderOccupation();

            cycleUse = new RiderCycleUse();
        }
Example #2
0
        private bool AddOrUpdateOccupation(riderDto riderDto)
        {
            bool blReturn = true;

            try
            {
                RiderOccupation occupation = riderDto.occupation;
                occupation.UserId = riderDto.Id;


                //Try validating on a per class basis here
                //    blReturn =  _riderRepository.AddIndividualToDatabase(individual);
                var dbValue = GetOccupationById(riderDto.Id);

                blReturn = (dbValue == null) ? _riderRepository.AddOccupationToDatabase(occupation) : _riderRepository.EditObjectInDatabase(dbValue, occupation);
            }

            catch (Exception ex)
            {
            }

            return(blReturn);
        }
Example #3
0
        public bool AddOccupationToDatabase(RiderOccupation occupation)
        {
            bool blSuccess = true;

            try
            {
                if (occupation == null)
                {
                    return(false);
                }
                else
                {
                    _db.RiderOccupations.Add(occupation);  // KEY ISSUE HERE TAKE A LOOK
                }
                _db.SaveChanges();
            }
            catch (Exception ex)
            {
                //Logger.Error("Failed AddIndividualToDatabase\n" + ex);
                //Logger.Error(ex.GetAllMessages());
                blSuccess = false;
            }
            return(blSuccess);
        }