public ActionResult Details(int id) { try { using (Context db = new Context()) { BLL.AcaoBLL acaoBLL = new BLL.AcaoBLL(db, _idUsuario); Acao acao = acaoBLL.FindSingle(e => e.idAcao == id, i => i.Controle, i => i.Menu); LogBLL.Insert(new LogDado("Details", "Ação", _idUsuario)); return View(AcaoVM.E2VM(acao)); } } catch (Exception ex) { RP.Util.Entity.ErroLog.Add(ex, Session.SessionID, _idUsuario); return RedirectToAction("Index"); } }
public JsonResult JsDetails(int idAcao) { try { using (Context db = new Context()) { BLL.AcaoBLL acaoBLL = new BLL.AcaoBLL(db, _idUsuario); Acao acao = acaoBLL.FindSingle(e => e.idAcao == idAcao, i => i.Controle, i => i.Menu); if (acao == null) { return Json(string.Empty, JsonRequestBehavior.AllowGet); } var result = new { acao.idAcao, acao.nmAcao, acao.dsAcao }; return Json(result, JsonRequestBehavior.AllowGet); } } catch (Exception ex) { Response.StatusCode = 500; return Json(RP.Util.Exception.Message.Get(ex), JsonRequestBehavior.AllowGet); } }
public ActionResult Edit(int id) { LogBLL.Insert(new LogDado("Edit(int id)", "Ação", _idUsuario)); List<string> icones = new List<string>(); System.IO.FileInfo finfo; try { foreach (string file in System.IO.Directory.GetFiles(Server.MapPath("~/Content/images/atalho"))) { finfo = new System.IO.FileInfo(file); icones.Add(System.IO.Path.GetFileNameWithoutExtension(finfo.Name)); } using (Context db = new Context()) { BLL.AcaoBLL acaoBLL = new BLL.AcaoBLL(db, _idUsuario); Acao acao = acaoBLL.FindSingle(e => e.idAcao == id, i => i.Controle, i => i.Menu); var model = AcaoVM.E2VM(acao); model.listaIcones = icones; return View(model); } } catch (Exception ex) { RP.Util.Entity.ErroLog.Add(ex, Session.SessionID, _idUsuario); return RedirectToAction("Index"); } }