Пример #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));
        }