public async Task <object> Update(int id, string day, [FromBody] MealKendo item)
        {
            JObject jsonMeal = JObject.Parse(JsonConvert.SerializeObject
                                                 (Meal.CreateFromOptionKendoList(item), serializerSettings));

            var jsonMealDay = new JObject
            {
                { JsonDataConfig.Key[0], day },
                { JsonDataConfig.Key[1], new JArray()
                  {
                      jsonMeal
                  } }
            };
            var jsonMealDays = new JArray
            {
                jsonMealDay
            };
            var jsonDiet = new JObject
            {
                { JsonDataConfig.Root, jsonMealDays }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrlUser() + id + JsonDataConfig.Url, jsonDiet.ToString());

            return(Empty);
        }
Example #2
0
        public async Task <object> Create([FromBody] Models.Doctor item)
        {
            var doctorJson = new JObject
            {
                { JsonDataConfig.Root, JObject.Parse(JsonConvert.SerializeObject(item, serializerSettings)) }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrl() + JsonDataConfig.Url, doctorJson.ToString());

            return(Empty);
        }
Example #3
0
        public async Task <object> Update(int id, [FromBody] Models.PatientData.GoalCaloriesOut item)
        {
            var goalCaloriesJson = new JObject
            {
                { JsonDataConfig.Root, JObject.Parse(JsonConvert.SerializeObject(item, serializerSettings)) }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrlUser() + id + JsonDataConfig.Url, goalCaloriesJson.ToString());

            return(Empty);
        }
        public async Task <object> Update(int id, [FromBody] GoalStepsDaily item)
        {
            var GoalsStepsDailyConfig = JsonDataConfig as GoalsStepsDaily;
            var goalStepsJson         = new JObject
            {
                { GoalsStepsDailyConfig.RootUpdate, JObject.Parse(JsonConvert.SerializeObject(item, serializerSettings)) }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrlUser() + id + GoalsStepsDailyConfig.UrlUpdate + "?"
                                     + QueryParamsConfig.Period + "=" + GoalsStepsDailyConfig.Period, goalStepsJson.ToString());

            return(Empty);
        }
        public async Task <object> Update(int id, [FromBody] GoalWeight item)
        {
            item.StartDate   = DateTimeNow;
            item.StartWeight = (await new WeightController(IPConfig, JsonStructureConfig).
                                Read(id, DateTimeNow.ToString(italianDateFormat))).Weight;

            var jsonGoalWeight = new JObject
            {
                { JsonDataConfig.Root, JObject.Parse(JsonConvert.SerializeObject(item, serializerSettings)) }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrlUser() + id + JsonDataConfig.Url, jsonGoalWeight.ToString());

            return(Empty);
        }
Example #6
0
        public async Task <object> Update(string email, [FromBody] List <Models.Patient> item)
        {
            var doctorConfig = JsonDataConfig as Doctor;

            var patientListIdJson = new JArray();

            item.ForEach(x => patientListIdJson.Add(x.Id));

            var patientListJson = new JObject
            {
                { doctorConfig.RootPatients, patientListIdJson }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrl() + JsonDataConfig.Url + "/" + email, patientListJson.ToString());

            return(Empty);
        }
Example #7
0
        public async Task <object> Update(int id, [FromBody] TrainingKendo item)
        {
            JObject jsonDayTrainings = JObject.Parse(JsonConvert.SerializeObject
                                                         (Models.Training.CreateFromOptionKendoList(item), serializerSettings));

            var jsonTrainings = new JObject
            {
                { JsonDataConfig.Root, new JArray()
                  {
                      jsonDayTrainings
                  } }
            };

            await APIUtils.PostAsync(IPConfig.GetTotalUrlUser() + id + JsonDataConfig.Url, jsonTrainings.ToString());

            return(Empty);
        }