コード例 #1
0
 public ActionResult Edit(TaskInputModel model)
 {
     CheckModelState(() => OnInvalidTaskForm("Edit", model));
     var task = mediator.Send(model.ToUpdateTaskCommand());
     this.Flash("success", string.Format("Updated task: {0}", task.Title));
     return RedirectToAction("Index");
 }
コード例 #2
0
 public ActionResult New(TaskInputModel model)
 {
     CheckModelState(() => OnInvalidTaskForm("New", model));
     Task task = mediator.Send(model.ToCreateTaskCommand());
     this.Flash("success", string.Format("Created new task: {0}", task.Title));
     return RedirectToAction("Index");
 }
コード例 #3
0
 public ActionResult New()
 {
     var model = new TaskInputModel();
     return View("New", model);
 }
コード例 #4
0
 public ActionResult Edit(TaskByIdQuery query)
 {
     var task = mediator.Request(query);
     var model = new TaskInputModel(task);
     return View("Edit", model);
 }
コード例 #5
0
 private ActionResult OnInvalidTaskForm(string viewName, TaskInputModel model)
 {
     this.Flash("danger", DEFAULT_FORM_ERROR_MESSAGE);
     return View(viewName, model);
 }
コード例 #6
0
 public void Post_Edit_should_redirect_to_index()
 {
     model = new TaskInputModel();
     var result = tasksController.Edit(model);
     MvcTest.RedirectsToRoute(result, action: "Index");
 }