public List <RecipeIngridientView> GetRecipeIngridientsByRecipeId(int recipeId) { List <RecipeIngridientView> recipeIngridientsList = new List <RecipeIngridientView>(); if (recipeId > 0) { _executerRecipeIngridientCmd executer = new _executerRecipeIngridientCmd(ExecuteRecipeIngridientSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("GetRecipeIngridientsByRecipeId", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@RecipeId", recipeId); recipeIngridientsList = executer(sqlConnection, cmd); } } } return(recipeIngridientsList); }
public RecipeIngridientView GetRecipeIngridient(int recipeId, int ingridientId) { List <RecipeIngridientView> recipeIngridientsList = new List <RecipeIngridientView>(); RecipeIngridientView recipeIngridientView = new RecipeIngridientView(); if (recipeId > 0 && ingridientId > 0) { _executerRecipeIngridientCmd executer = new _executerRecipeIngridientCmd(ExecuteRecipeIngridientSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("GetRecipeIngridient", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@RecipeId", recipeId); cmd.Parameters.AddWithValue("@IngridientId", ingridientId); recipeIngridientsList = executer(sqlConnection, cmd); recipeIngridientView = recipeIngridientsList.FirstOrDefault(); } } } return(recipeIngridientView); }