Пример #1
0
        public async Task <UserResponse> UpdateHealthInfor(HealthInfor userInfo, string token)
        {
            var httpClient = new HttpClient(new HttpLoggingHandler())
            {
                BaseAddress = URL_LOGIN
            };

            httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
            var userApi = RestService.For <UserApi>(httpClient);
            var request = new ProvideInforRequest
            {
                healthHeight     = userInfo.height,
                healthWeight     = userInfo.weight,
                ic               = userInfo.ic,
                healthProfession = userInfo.profession,
                bodyMass         = userInfo.bodyMass,
                habit            = userInfo.habit,
                lifeStyle        = userInfo.basicLifeStyle,
                bmi              = userInfo.bmi,
                fatContent       = userInfo.fat,
                stomachFat       = userInfo.stomachFat,
                muscleContent    = userInfo.muscle
            };

            return(await userApi.UpdateHealthInformation(request).ConfigureAwait(false));
        }
Пример #2
0
        public async Task <UserResponse> ProvideInfor(UserInfor userInfo)
        {
            var httpClient = new HttpClient(new HttpLoggingHandler())
            {
                BaseAddress = URL_LOGIN
            };
            var userApi = RestService.For <UserApi>(httpClient);
            var request = new ProvideInforRequest
            {
                health_height     = userInfo.height,
                health_weight     = userInfo.weight,
                ic                = userInfo.ic,
                health_profession = userInfo.profession,
                //body_mass = userInfo.bodyMass,
                //habit = userInfo.habit,
                //life_style = userInfo.basicLifeStyle,
                //bmi = userInfo.bmi,
                //fat = userInfo.fat,
                //stomachfat = userInfo.stomachFat,
                //muscle = userInfo.muscle
            };

            return(await userApi.ProvideInfor(request).ConfigureAwait(false));
        }