public ActionResult Update(int id, Article article) { if (article != null) { article.id = id; } return View(article); }
public ActionResult Load(int id) { Article a = new Article() { Title = "Este é um post no blog!", Description = "Esse é o texto de um artigo para o teste da framework!", id = 1 }; ArticleComment c = new ArticleComment() { id = id, Name = "Callebe", Comment = "Teste de comentário sendo carregado", Article = a }; return View(c); }
public ActionResult Get() { List<ArticleComment> comments = new List<ArticleComment>(); if (Request.QueryString.Count > 0) { comments = new List<ArticleComment>() { new ArticleComment() { Name = "Callebe", Comment = "Meu comentário filtrado", id = 1 }, new ArticleComment() { Name = "Callebe", Comment = "Meu segundo comentário cfiltrado", id = 2 } }; } else { Article artigo1 = new Article() { Title = "Meu primeiro post no blog!", Description = "Esse é o texto do primeiro artigo para o teste da framework!", id = 1 }; comments = new List<ArticleComment>() { new ArticleComment() { Name = "Callebe", Comment = "Meu comentário sobre o artigo 1", Article = artigo1, id = 1 }, new ArticleComment() { Name = "Callebe", Comment = "Meu segundo comentário comentário sobre o artigo 1", Article = artigo1, id = 2 } }; } return View(comments); }