// GET: IngredientGroups/Create //public ActionResult Create() //{ // return View(); //} public async Task <ActionResult> Create(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var ingredientes = await db.Ingredientes.FindAsync(id); if (ingredientes == null) { return(HttpNotFound()); } var view = new IngredientGroups { IngredientId = ingredientes.IngredientId, }; return(View(view)); } catch (Exception ex) { return(View()); } }
public async Task <ActionResult> DeleteConfirmed(int id) { IngredientGroups ingredientGroups = await db.IngredientGroups.FindAsync(id); db.IngredientGroups.Remove(ingredientGroups); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "IngredientGroupId,Name")] IngredientGroups ingredientGroups) { if (ModelState.IsValid) { db.Entry(ingredientGroups).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(ingredientGroups)); }
public async Task <ActionResult> Create([Bind(Include = "IngredientGroupId,Name")] IngredientGroups ingredientGroups) { if (ModelState.IsValid) { db.IngredientGroups.Add(ingredientGroups); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(ingredientGroups)); }
// GET: IngredientGroups/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IngredientGroups ingredientGroups = await db.IngredientGroups.FindAsync(id); if (ingredientGroups == null) { return(HttpNotFound()); } return(View(ingredientGroups)); }