public ActionResult ExcluirAnexo(int codigo) { using (var bll = new ParecerSolicitacaoBLL()) { var p = Session["Parecer"] as ParecerSolicitacao; var anxBLL = new DocumentoAnexadoAprovacaoBLL(); try { var anx = p.DocumentosAnexadosAprovacao.Where(c => c.CodDocumentoAnexadoApr == codigo).Single(); p.DocumentosAnexadosAprovacao.Remove(anx); anxBLL.Excluir(anx); } catch (Exception ex) { return Json(new { erro = ex.Message }, JsonRequestBehavior.DenyGet); } Session["Parecer"] = p; return Json(new { msg = "Anexo excluido" }, JsonRequestBehavior.DenyGet); } }