public void SetRelation(Set_DishIngredient_Relation relation) { string sqlexpression = "dishes_addrelationtoingredient"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(sqlexpression, connection); command.CommandType = System.Data.CommandType.StoredProcedure; SqlParameter IdParam = new SqlParameter { ParameterName = "@id", Value = relation.id }; command.Parameters.Add(IdParam); SqlParameter DishIdParam = new SqlParameter { ParameterName = "@dishid", Value = relation.DishId }; command.Parameters.Add(DishIdParam); SqlParameter IngredientIdParam = new SqlParameter { ParameterName = "@ingredientid", Value = relation.IngredientId }; command.Parameters.Add(IngredientIdParam); SqlParameter WeightParam = new SqlParameter { ParameterName = "@weight", Value = relation.Weight }; command.Parameters.Add(WeightParam); try { command.ExecuteNonQuery(); } catch { } } }
public void SetRelation(Set_DishIngredient_Relation relation) { dal.SetRelation(relation); }