public async Task <ActionResult> DeleteConfirmed(int id) { CuisineGroup cuisineGroup = await db.CuisineGroups.FindAsync(id); db.CuisineGroups.Remove(cuisineGroup); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "CuisineGroupId,Name")] CuisineGroup cuisineGroup) { if (ModelState.IsValid) { db.Entry(cuisineGroup).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cuisineGroup)); }
public async Task <ActionResult> Create([Bind(Include = "CuisineGroupId,Name")] CuisineGroup cuisineGroup) { if (ModelState.IsValid) { db.CuisineGroups.Add(cuisineGroup); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(cuisineGroup)); }
// GET: CuisineGroups/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CuisineGroup cuisineGroup = await db.CuisineGroups.FindAsync(id); if (cuisineGroup == null) { return(HttpNotFound()); } return(View(cuisineGroup)); }