public ActionResult DeleteConfirmed(int id) { SetorEntity setorentity = db.Setores.Find(id); db.Setores.Remove(setorentity); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /Setor/Edit/5 public ActionResult Edit(int id = 0) { SetorEntity setorentity = db.Setores.Find(id); if (setorentity == null) { return(HttpNotFound()); } return(View(setorentity)); }
public ActionResult Create(SetorEntity setorentity) { FillAudit(setorentity); if (ModelState.IsValid) { db.Setores.Add(setorentity); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(setorentity)); }
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)); }