private void ChangeYeast(Yeast yeastInfo) { if (CurrentRecipe.YeastIngredient == null) { CurrentRecipe.YeastIngredient = YeastUtility.CreateYeastIngredient(); } CurrentRecipe.YeastIngredient.YeastInfo = yeastInfo; CurrentRecipe.UpdateRecipeOutcome(); }
public async Task SetCurrentRecipe(string userId, int selectedRecipeId) { var recipe = await _db.Recipes.FirstOrDefaultAsync(r => r.UserId == userId && r.Id == selectedRecipeId); if (recipe != null) { var currentRecipe = await _db.CurrentRecipes.FirstOrDefaultAsync(r => r.UserId == userId); if (currentRecipe == null) { currentRecipe = new CurrentRecipe { UserId = userId, RecipeId = selectedRecipeId }; _db.CurrentRecipes.Add(currentRecipe); } currentRecipe.SelectedIngredients = null; currentRecipe.RecipeId = selectedRecipeId; await _db.SaveChangesAsync(); } }
public bool IsEmpty() { return((PowerUsage == 0) && (CurrentRecipe.IsEmpty()) && (Total == 0) && (Ingredients.Count == 0)); }