Пример #1
0
        public IHttpActionResult Index([FromBody] IdentifyViewModel vm)
        {
            ITrackerService service = new TrackerService();

            service.IdentifyContact(vm.PersonId);

            var response = new ProfileViewModel(contactProfileProvider);

            var name = contactProfileProvider.PersonalInfo.FirstName;

            Guid guid;

            // if name is empty, unkown or it has a guid, treat it as "no name". The client should trigger the update name action
            if (string.IsNullOrEmpty(name) ||
                string.Compare(name, "unknown", true, CultureInfo.CurrentCulture) == 0 ||
                Guid.TryParse(name, out guid))
            {
                response.Name = string.Empty;
            }
            else
            {
                response.Name = name;
            }

            return(new JsonResult <ProfileViewModel>(response, new JsonSerializerSettings(), Encoding.UTF8, this));
        }
Пример #2
0
        /// <summary>
        /// Sets the ID on the server for current connection, using the ID the object is constructed with.
        /// </summary>
        /// <returns>An IdentifyResponse object, containing the response on the identification process.</returns>
        public async Task <IdentifyResponse> Identify()
        {
            var model = new IdentifyViewModel {
                PersonId = PersonId
            };

            return(await connection.PostData <IdentifyResponse>(model, "api/Identify"));
        }