public async Task UpdateMealSettings(MealSettingsEntity model)
        {
            var cloudTable = await _tableStorage.GetTableReference(_mealSettingTable);

            TableOperation op     = TableOperation.Replace(model);
            var            result = cloudTable.ExecuteAsync(op);
        }
Example #2
0
        private void ChangeMenuSettings(UserEntity user, MenuSettings menuSettings)
        {
            MealSettingsEntity mealSettings = _repository.MealSetting.GetMealSettingFromTable(user.IdMealSetting).Result;

            if (mealSettings.MealSettingsModelData != null)
            {
                mealSettings.MealSettingsModelData.DietAim     = menuSettings.DietAim;
                mealSettings.MealSettingsModelData.Preferences = menuSettings.Preferences;
                _repository.MealSetting.UpdateMealSettings(mealSettings);
            }
        }
        public async Task <MealSettingsModel> InsertMealSettingsIntoTable(MealSettingsModel model)
        {
            var table = await _tableStorage.GetTableReference(_mealSettingTable);

            model.IdMealSettings = Guid.NewGuid().ToString();

            var entity = new MealSettingsEntity()
            {
                PartitionKey          = model.IdMealSettings,
                RowKey                = new Guid().ToString(),
                MealSettingsModelData = model
            };

            var tableOperation = TableOperation.InsertOrMerge(entity);
            await table.ExecuteAsync(tableOperation);

            return(model);
        }