Ejemplo n.º 1
0
        public static ParticipantDBViewModel storingtoDB(ParticipantViewModel Participantvalues, ScoreModel score, GeoLocProps geo, UserAgent.UserAgent useragent, MapPoint mapCords)
        {
            ParticipantDBViewModel dbModel = new ParticipantDBViewModel();

            dbModel.Age                    = Participantvalues.Age;
            dbModel.AgeValid               = score.AgeValid;
            dbModel.City                   = Participantvalues.City;
            dbModel.CityValid              = score.CityValid;
            dbModel.Date_of_Birth          = DateTime.Parse(Participantvalues.MonthofBirth + "/" + Participantvalues.YearofBirth);
            dbModel.EmailAddress           = Participantvalues.EmailAddress;
            dbModel.FirstName              = Participantvalues.FirstName;
            dbModel.FirstName_Match        = score.FirstName_Match;
            dbModel.LastName               = Participantvalues.LastName;
            dbModel.LastName_Match         = score.LastName_Match;
            dbModel.cords_IpAddrMatch      = score.Coordinates_Match;
            dbModel.OtherGenderType        = Participantvalues.othergender;
            dbModel.GenderIdentity         = Participantvalues.GenderIdentity;
            dbModel.OtherSexualOrientation = Participantvalues.otherSex;
            dbModel.OtherRace              = Participantvalues.OtherRace;
            dbModel.Password               = "";
            dbModel.Hispanic               = Participantvalues.Hispanic;
            dbModel.PhoneNumber            = Participantvalues.PhoneNumber;
            dbModel.Race                   = Participantvalues.Race;
            dbModel.SexualOrientation      = Participantvalues.SexualOrientation;
            dbModel.State                  = Participantvalues.State;
            dbModel.StateValid             = score.StateValid;
            dbModel.Verified               = score.Verified;
            dbModel.Zip                    = Participantvalues.Zip;
            dbModel.geo_IP                 = geo.IP;
            dbModel.geo_City               = geo.City;
            dbModel.geo_CountryName        = geo.CountryName;
            dbModel.geo_RegionName         = geo.RegionName;
            dbModel.geo_ZipCode            = geo.ZipCode;
            dbModel.geo_lattude            = geo.Latitude;
            dbModel.geo_longitude          = geo.Longitude;
            dbModel.OS      = useragent.OS.Name.ToString();
            dbModel.Browser = useragent.Browser.Name.ToString();

            dbModel.AddrLatitude  = mapCords.Latitude;
            dbModel.AddrLongitude = mapCords.Longitude;
            dbModel.latlangMatch  = mapCords.MatchCords;

            dbModel.FinalScaoreVal = score.FinalScaoreVal;
            dbModel.TwoFactorScore = score.TwoFactorScore;
            dbModel.SocialScore    = score.SocialScore;
            dbModel.AgeScore       = score.AgeScore;
            dbModel.AddressScore   = score.AddressScore;
            dbModel.RegisterDate   = DateTime.Now.ToString("U");
            return(dbModel);
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------------------------------------------------------



        //--------------------------------------------------------------------------------------------------------------------------

        public void storetoDB(ViewModels.ParticipantViewModel Participantvalues, ScoreModel score, GeoLocProps geo, UserAgent.UserAgent useragent, MapPoint mapCoords)
        {
            ParticipantDBViewModel dbModel = CertifyParticipant.storingtoDB(Participantvalues, score, geo, useragent, mapCoords);

            Participant participant = Mapper.Map <Participant>(dbModel);


            SurveyOptionsDBModel surveymodel = CalculateScore.getthesurveyObject();

            DAL.Models.Survey surveydal = new DAL.Models.Survey();
            //defining the survey object
            surveydal.Survey_Name       = surveymodel.Survey_Name;
            surveydal.Survey_Active     = surveymodel.Survey_Active;
            surveydal.SurveyId          = surveymodel.SurveyId;
            surveydal.CalAddressScore   = surveymodel.CalAddressScore;
            surveydal.CalAgeScore       = surveymodel.CalAgeScore;
            surveydal.CalSocialScore    = surveymodel.CalSocialScore;
            surveydal.CalTwoFactorScore = surveymodel.CalTwoFactorScore;

            _unitOfWork.ParticipantRepository.InsertSurveyParticipant(participant);

            _unitOfWork.ParticipantRepository.InsertSurveyParticipantTable(participant, surveydal);
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> UpdateMember(int id, [FromBody] ParticipantDBViewModel participantViewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            try
            {
                Participant participant = Mapper.Map <Participant>(participantViewModel);
                var         status      = await _unitOfWork.ParticipantRepository.UpdateMemberAsync(participant);

                if (!status)
                {
                    return(BadRequest());
                }
                return(Ok());
            }
            catch (Exception exp)
            {
                _logger.LogError(exp.Message);
                return(BadRequest());
            }
        }