// GET: Noticias/Details/5 public ActionResult Details(int id) { var noticia = _noticiaApp.GetById(id); var noticiaViewModel = Mapper.Map <Noticia, NoticiaViewModel>(noticia); return(View(noticiaViewModel)); }
public ActionResult Detalhes(int id) { var noticia = _noticiaApp.GetById(id); var noticiaViewModel = Mapper.Map <Noticia, NoticiaViewModel>(noticia); ViewBag.UsuarioId = new SelectList(_usuarioApp.GetAll(), "UsuarioId", "Nome", noticiaViewModel.UsuarioId); return(View(noticiaViewModel)); }
public ActionResult UploadFotoNoticia(HttpPostedFileBase file) { if ((String)Session["Ativa"] == null) { return(RedirectToAction("Login", "ControleAcesso")); } if (file == null) { ModelState.AddModelError("", ERP_Condominio_Resources.ResourceManager.GetString("M0019", CultureInfo.CurrentCulture)); return(RedirectToAction("VoltarAnexoNoticia")); } Int32 idAss = (Int32)Session["IdAssinante"]; Int32 idNot = (Int32)Session["IdVolta"]; NOTICIA item = baseApp.GetById(idNot); USUARIO usu = (USUARIO)Session["UserCredentials"]; var fileName = Path.GetFileName(file.FileName); if (fileName.Length > 100) { ModelState.AddModelError("", ERP_Condominio_Resources.ResourceManager.GetString("M0024", CultureInfo.CurrentCulture)); return(RedirectToAction("VoltarAnexoNoticia")); } String caminho = "/Imagens/" + idAss.ToString() + "/Noticias/" + item.NOTC_CD_ID.ToString() + "/Fotos/"; String path = Path.Combine(Server.MapPath(caminho), fileName); file.SaveAs(path); //Recupera tipo de arquivo extensao = Path.GetExtension(fileName); String a = extensao; // Gravar registro item.NOTC_AQ_FOTO = "~" + caminho + fileName; objetoAntes = item; Int32 volta = baseApp.ValidateEdit(item, objetoAntes); return(RedirectToAction("VoltarAnexoNoticia")); }