public void showData() { var Recipes = RecipeBLL.Search(pageIndex, pageSize, sortBy, sortOrder, keyword); dgRecipes.ItemsSource = Recipes.Items; pageCount = Recipes.PageCount; }
public IHttpActionResult GetRecipeWithIngredients(int recipeId) { RecipeBLL bll = new RecipeBLL(); var recipes = bll.GetRecipeWithIngredients(recipeId); if (recipes == null) { return(Content(HttpStatusCode.NotFound, "Recipe does not exist.")); } else { return(Ok(recipes)); } }
public IHttpActionResult GetActiveRecipes() { RecipeBLL bll = new RecipeBLL(); var recipes = bll.GetListOfActiveRecipes(); if (recipes == null) { return(Content(HttpStatusCode.NotFound, "List of recipes does not exist.")); } else { return(Ok(recipes)); } }
private void btnDelete_Click(object sender, RoutedEventArgs e) { Recipe recipe = ((FrameworkElement)sender).DataContext as Recipe; if (MessageBox.Show("Are you sure you want to delete " + recipe.Title + "?", "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { var op = RecipeBLL.Delete(recipe.RecipeID); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Recipe is successfully deleted from table"); showData(); } } ; }
private void btnSave_Click(object sender, RoutedEventArgs e) { var op = RecipeBLL.Update(new Recipe() { RecipeID = thisRecipe.RecipeID, Ingredients = txtIngredients.Text, UnitMeasure = txtUnitofMeasure.Text, Instruction = txtIngredients.Text, Title = txtTitle.Text, Price = txtPrice.Text }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Succesfully Update"); } myParentWindow.showData(); this.Close(); }
private void btnAdd_Click(object sender, RoutedEventArgs e) { var op = RecipeBLL.Add(new Recipe() { Ingredients = txtIngredients.Text, Instruction = txtInstruction.Text, Price = txtPrice.Text, Title = txtTitle.Text, UnitMeasure = txtUnitofMeasure.Text, RecipeID = Guid.NewGuid() }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Ingrediets is Succesfully added to table"); } myParentWindow.showData(); this.Close(); }