コード例 #1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            MercadoriaModel mercadoriaModel = await db.MercadoriaModels.FindAsync(id);

            db.MercadoriaModels.Remove(mercadoriaModel);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        // 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));
        }