public async Task <ActionResult> Publicacao(string id) { var publicacao = await _mongo.Publications.Find(f => f.Id == id).FirstOrDefaultAsync(); if (publicacao == null) { return(RedirectToAction("Index")); } var model = new PublicacaoModel { Publicacao = publicacao, NovoComentario = new NovoComentarioModel { PublicacaoId = id } }; return(View(model)); }
public async Task <ActionResult> Publicacao(string id) { Publicacao publicacao = await daoPublicacao.ConsultarAsync(id); if (publicacao == null) { return(RedirectToAction("Index")); } var model = new PublicacaoModel { Publicacao = publicacao, NovoComentario = new NovoComentarioModel { PublicacaoId = id } }; return(View(model)); }
public async Task <ActionResult> Publicacao(string id) { var connectarMongoDB = new AcessoMongoDB(); var publicacao = await connectarMongoDB.Publicacoes.Find(x => x.Id == id).SingleOrDefaultAsync(); if (publicacao == null) { return(RedirectToAction("Index")); } var model = new PublicacaoModel { Publicacao = publicacao, NovoComentario = new NovoComentarioModel { PublicacaoId = id } }; return(View(model)); }