public override void ReadEntity(IDictionary <string, EntityProperty> properties, OperationContext context) { string idMealSetting = ""; DietAim dietAim = 0; int mealCount = 0; DietPreferences preferences = 0; foreach (var prop in properties) { switch (prop.Key.ToLower()) { case "idmealsettings": idMealSetting = prop.Value.StringValue; break; case "dietaim": dietAim = (DietAim)prop.Value.Int32Value; break; case "preferences": preferences = (DietPreferences)prop.Value.Int32Value; break; case "mealcount": mealCount = (int)prop.Value.Int32Value; break; } MealSettingsModelData = new MealSettingsModel(idMealSetting, dietAim, mealCount, preferences); } }
public MealSettingsModel(string idMealSettings, DietAim dietAim, int?mealCount, DietPreferences preferences) { IdMealSettings = idMealSettings; DietAim = dietAim; MealCount = mealCount; Preferences = preferences; }