Пример #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            SetorEntity setorentity = db.Setores.Find(id);

            db.Setores.Remove(setorentity);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #2
0
        //
        // GET: /Setor/Edit/5

        public ActionResult Edit(int id = 0)
        {
            SetorEntity setorentity = db.Setores.Find(id);

            if (setorentity == null)
            {
                return(HttpNotFound());
            }
            return(View(setorentity));
        }
Пример #3
0
        public ActionResult Create(SetorEntity setorentity)
        {
            FillAudit(setorentity);
            if (ModelState.IsValid)
            {
                db.Setores.Add(setorentity);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(setorentity));
        }
Пример #4
0
        public ActionResult Edit(SetorEntity setorentity)
        {
            FillAuditUpdate(setorentity);

            setorentity.DtCadastro = new BaseContext().Categorias.Find(setorentity.Id).DtCadastro;

            if (ModelState.IsValid)
            {
                db.Entry(setorentity).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(setorentity));
        }