Advertisement
Guest User

Untitled

a guest
Feb 24th, 2012
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.34 KB | None | 0 0
  1. public ActionResult Create(Question question)
  2. {
  3.     if (ModelState.IsValid)
  4.     {
  5.         question.Answers = new List<Answer>();
  6.         question.Answers.Add(new Answer { AnswerText = "MyAnswer" });
  7.         db.Questions.Add(question);
  8.         db.SaveChanges();
  9.         return RedirectToAction("Index");  
  10.     }
  11.     return View(question);
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement