public ActionResult OnPostDelete(int id) { var data = (from i in _context.Ingredient where i.IngredientID == id select i).SingleOrDefault(); _context.Remove(data); _context.SaveChanges(); return(new EmptyResult()); //return RedirectToPage(new{id = recipeid}); }
public ActionResult OnPostDelete(int id) { var data = (from i in _context.Recipe where i.RecipeID == id select i).SingleOrDefault(); var Ingredient = _context.Ingredient.Where(x => x.RecipeID == id); _context.Ingredient.RemoveRange(Ingredient); _context.Remove(data); _context.SaveChanges(); return(new EmptyResult()); //return RedirectToPage(); }