コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Bombona bombona = db.Bombona.Find(id);

            db.Bombona.Remove(bombona);
            db.SaveChanges();
            TempData["MSG"] = "success|Bombona deletada";
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "Id,Nome,Capacidade,DataInstalacao,LaboratorioId")] Bombona bombona)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bombona).State = EntityState.Modified;
         db.SaveChanges();
         TempData["MSG"] = "success|Edição realizada";
         return(RedirectToAction("Index"));
     }
     TempData["MSG"]       = "Warning|Edição não realizada";
     ViewBag.LaboratorioId = new SelectList(db.Laboratorio, "Id", "Nome", bombona.LaboratorioId);
     return(View(bombona));
 }
コード例 #3
0
 public ActionResult Create([Bind(Include = "Id,Nome,Capacidade,DataInstalacao,LaboratorioId")] Bombona bombona)
 {
     if (ModelState.IsValid)
     {
         bombona.DataInstalacao = DateTime.Now;
         db.Bombona.Add(bombona);
         db.SaveChanges();
         TempData["MSG"] = "success|Cadastro realizado";
         return(RedirectToAction("Index"));
     }
     TempData["MSG"]       = "Warning|Cadastro não realizado";
     ViewBag.LaboratorioId = new SelectList(db.Laboratorio, "Id", "Nome", bombona.LaboratorioId);
     return(View(bombona));
 }
コード例 #4
0
        // GET: Bombonas/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bombona bombona = db.Bombona.Find(id);

            if (bombona == null)
            {
                return(HttpNotFound());
            }
            return(View(bombona));
        }
コード例 #5
0
        public ActionResult Delete(int id)
        {
            Bombona deletarBombona = db.Bombona.Find(id);

            if (deletarBombona == null)
            {
                return(HttpNotFound());
            }

            db.Bombona.Remove(deletarBombona);
            db.SaveChanges();
            TempData["MSG"] = "success|Bombona coletada";
            return(RedirectToAction("Index", "EmpresaColeta"));
        }
コード例 #6
0
        // GET: Bombonas/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Bombona bombona = db.Bombona.Find(id);

            if (bombona == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LaboratorioId = new SelectList(db.Laboratorio, "Id", "Nome", bombona.LaboratorioId);
            return(View(bombona));
        }