예제 #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);
 }
 public void Post_Edit_should_redirect_to_index()
 {
     model = new TaskInputModel();
     var result = tasksController.Edit(model);
     MvcTest.RedirectsToRoute(result, action: "Index");
 }