RavenOverflow.Web.Areas.Question.Controllers.QuestionsController.Create C# (CSharp) Méthode

Create() private méthode

private Create ( ) : System.Web.Mvc.ActionResult
Résultat System.Web.Mvc.ActionResult
        public ActionResult Create()
        {
            var inputModel = new QuestionViewModel(ClaimsUser)
                            {
                                Header = "Ask a Question"
                            };
            return View("Create", inputModel);
        }

Same methods

QuestionsController::Create ( QuestionInputModel inputModel ) : System.Web.Mvc.ActionResult

Usage Example

        public void GivenAnInValidQuestion_Create_ReturnsAResultView()
        {
            using (IDocumentSession documentSession = DocumentStore.OpenSession())
            {
                // Arrange.
                IQuestionService questionService = new QuestionService(documentSession);
                var questionsController = new QuestionsController(documentSession, questionService);
                ControllerUtilities.SetUpControllerContext(questionsController);
                var createInputModel = new CreateInputModel
                                           {
                                               Content = "Some content",
                                               Subject = null,
                                               // RuRoh - dat ist missin'
                                               Tags = "tag1 tag2 tag3-3-3"
                                           };

                // Now pretend the model binding raised an error with the input model.
                questionsController.ModelState.AddModelError("key", "error message");

                // Act.
                var result = questionsController.Create(createInputModel) as ViewResult;

                // Assert.
                Assert.NotNull(result);
                Assert.Equal("Create", result.ViewName);
            }
        }
All Usage Examples Of RavenOverflow.Web.Areas.Question.Controllers.QuestionsController::Create