Exemplo n.º 1
0
 public IHttpActionResult UpdateMinimumInfo([FromBody] MinimumSurveyInfo minimumSurveyInfo)
 {
     //second half of RouterEmailPush.
     //if all info not present then it gets sent in.
     //then set up for surveys
     try
     {
         var _manager = new RouterManager();
         _manager.UpdateMinimumSurveyInfo(minimumSurveyInfo);
         RouterContact user = _manager.RouterContactFullSetup(minimumSurveyInfo.EmailAddress);
         return(Ok(user.UniqueId));
     }
     catch (Exception e)
     {
         return(Ok(e.Message));
     }
 }
Exemplo n.º 2
0
        public IHttpActionResult RouterEmailPush([FromUri] string emailAddress)
        {
            //this method takes an email address. Checks if minimum data exists. Then
            //if it doesn't it returns a flag to collect more data.
            //if minumum data does exist it creates a new router user and redirects them ot
            //the daily surveys page
            var _manager = new RouterManager();
            MinimumInfoExistsResult minimumInfoExistsResult = _manager.CheckIfMinimumInfoExistsForEmail(emailAddress);

            if (minimumInfoExistsResult.HasMinimumInfo && !minimumInfoExistsResult.HasRounterContact)
            {
                RouterContact user = _manager.RouterContactFullSetup(emailAddress);
                minimumInfoExistsResult.HasRounterContact     = true;
                minimumInfoExistsResult.RouterContactUniqueId = user.UniqueId;
            }

            return(Ok(minimumInfoExistsResult));
        }
Exemplo n.º 3
0
        public IHttpActionResult UpdateRegistration([FromUri] Guid userId, [FromBody] UserRegistrationRequest userRegistrationRequest)
        {
            if (!string.IsNullOrWhiteSpace(userRegistrationRequest.Zip))
            {
                XVerifyManager x       = new XVerifyManager();
                var            zipinfo = x.GetZipcodeLookup(userRegistrationRequest.Zip);
                if (!zipinfo.IsValid)
                {
                    return(Ok(new UserRegistrationResponse()
                    {
                        ZipIsValid = false,
                        Success = false,
                        Message = "Zipcode is invalid."
                    }));
                }
                userRegistrationRequest.State = zipinfo.zipdata.state;
                userRegistrationRequest.City  = zipinfo.zipdata.primary_city;
            }

            var m = new MobileUserManager();
            int?routerContactId = m.Register(userId, userRegistrationRequest);

            if (!routerContactId.HasValue)
            {
                var rm            = new RouterManager();
                var routerContact = rm.RouterContactFullSetup(userRegistrationRequest.EmailAddress);
                routerContactId = routerContact.RouterContactId;
                m.SetRouterContact(routerContactId, userId);
            }

            return(Ok(new UserRegistrationResponse()
            {
                ZipIsValid = true,
                Success = true,
                Message = "Success."
            }));
        }