public void UpdateProfile([NotNull] SportPreferencesPayload data)
 {
     Tracker.Current.Interaction.Profiles.Remove(SportsFacet.DefaultKey);
     if (data.Ratings != null)
     {
         Tracker.Current.Interaction.Profiles[SportsFacet.DefaultKey].Score(data.Ratings.ToDictionary(kvp => kvp.Key, kvp => (double)kvp.Value));
     }
 }
        public void UpdateFacet([NotNull] SportPreferencesPayload data)
        {
            var trackerContact = ContactExtensions.GetCurrentTrackerContact();

            Assert.IsNotNull(trackerContact, "Current contact is null");

            var facets = trackerContact.GetXConnectFacets();

            UpdateSportsFacet(data, facets);

            trackerContact.UpdateXConnectFacets(facets);
        }
예제 #3
0
        public ActionResult UpdateProfile([System.Web.Http.FromBody] SportPreferencesPayload data)
        {
            try
            {
                service.UpdateProfile(data);
            }
            catch (Exception ex)
            {
                Log.Error($"Error while running UpdateProfile API", ex, this);
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError, ex.Message));
            }

            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
        protected void UpdateSportsFacet(SportPreferencesPayload data, Dictionary <string, Facet> facets)
        {
            SportsFacet sportsFacet;

            if (facets.ContainsKey(SportsFacet.DefaultKey))
            {
                sportsFacet         = (SportsFacet)facets[SportsFacet.DefaultKey];
                sportsFacet.Ratings = data.Ratings;
            }
            else
            {
                sportsFacet = new SportsFacet()
                {
                    Ratings = data.Ratings,
                };

                facets.Add(SportsFacet.DefaultKey, sportsFacet);
            }
        }