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