public WcfMeal(Meal meal) { this.MealName = meal.MealName; this.Calories = meal.Calories; this.Protein = meal.Protein; this.Fat = meal.Fat; this.CarboHydrates = meal.CarboHydrates; }
public static bool AddMeal(Meal meal) { var query = from dbmeal in dcc.Meals where dbmeal.MealName == meal.MealName select dbmeal.MealId; if (query.Count() == 0) { try { dcc.Meals.Add(meal); dcc.SaveChanges(); return true; } catch (Exception) { } } return false; }