public async Task <ActionResult> DeleteConfirmed(int id) { MercadoriaModel mercadoriaModel = await db.MercadoriaModels.FindAsync(id); db.MercadoriaModels.Remove(mercadoriaModel); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,Tipo,Nome,Quantidade,Preco,TipoNegocio")] MercadoriaModel mercadoriaModel) { if (ModelState.IsValid) { db.Entry(mercadoriaModel).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(mercadoriaModel)); }
public async Task <ActionResult> Create([Bind(Include = "Id,Tipo,Nome,Quantidade,Preco,TipoNegocio")] MercadoriaModel mercadoriaModel) { if (ModelState.IsValid) { db.MercadoriaModels.Add(mercadoriaModel); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(mercadoriaModel)); }
// GET: Mercadoria/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } MercadoriaModel mercadoriaModel = await db.MercadoriaModels.FindAsync(id); if (mercadoriaModel == null) { return(HttpNotFound()); } return(View(mercadoriaModel)); }