public List <DayMeal> GetWeekDate(int Year) { DayMeal d = new DayMeal(); List <DayMeal> datesW = d.GetWeekDate(Year); return(datesW); }
public bool CreateMealsOfDayInAWeek(DayMeal dm) { Meal m = new Meal(); bool saved = m.CreateMealsOfDayInAWeek(dm); return(saved); }
public static void DeleteDailyFood(DayMeal dayMeal) { try { db.Delete(dayMeal); } catch (Exception exception) { } }
public static DayMeal DtoToDayMeal(DayMealDTO product, DayMeal ent = null) { if (product != null) { return(ent = ent ?? new DayMeal { DayMealId = product.DayMealId, DayId = product.DayId, MealId = product.MealId, Category = product.Category }); } return(null); }
public static DayMealDTO DayMealToDto(DayMeal product, DayMealDTO dto = null) { if (product != null) { return(dto = dto ?? new DayMealDTO { DayMealId = product.DayMealId, DayId = product.DayId, MealId = product.MealId, Category = product.Category }); } return(null); }
public static void AddDayMeal(Food food, decimal servingSize) { DayMeal dayMeal = new DayMeal(); dayMeal.Id = DatabaseManager.GetLastDayMealId() + 1; dayMeal.Day = DateTime.Now.ToLocalTime(); dayMeal.FoodId = food.Id; dayMeal.FoodName = food.Name; dayMeal.Grams = servingSize * food.ServingSizeGrams; dayMeal.Calories = food.CaloriesInServingSize(servingSize); dayMeal.Carbs = food.CarbsInServingSize(servingSize); dayMeal.Sugar = food.SugarsInServingSize(servingSize); dayMeal.Proteins = food.ProteinsInServingSize(servingSize); dayMeal.Fats = food.FatsInServingSize(servingSize); db.Insert(dayMeal); }
private async void OpenEditDayMealDialogAsync(DayMeal meal) { var mealClone = meal.Clone(); var dialog = _dialogs.For <DayMealDialogViewModel>(DialogsIdentifier); dialog.Data.DialogTitle = "Modified meal"; dialog.Data.SubmitButtonTitle = "Save"; dialog.Data.DayMeal = DayMealViewModel.FromModel(mealClone); var dialogResult = await dialog.Show(); if (dialogResult != DialogResult.Ok) { return; } mealClone = dialog.Data.DayMeal.ToModel(); EatingDay.Meals.Replace(meal, mealClone); }
private async void OpenAddDayMealDialogAsync() { var meal = new DayMeal { Hour = DateTime.Today.Hour }; var dialog = _dialogs.For <DayMealDialogViewModel>(DialogsIdentifier); dialog.Data.DialogTitle = "New meal"; dialog.Data.SubmitButtonTitle = "Create"; dialog.Data.DayMeal = DayMealViewModel.FromModel(meal); var dialogResult = await dialog.Show(); if (dialogResult != DialogResult.Ok) { return; } meal = dialog.Data.DayMeal.ToModel(); EatingDay.Meals.Add(meal); EatingDay.Meals.Refresh(meal); }
private void RemoveMeal(DayMeal meal) => EatingDay.Meals.RemoveByReference(meal);