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"); }
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"); }
public ActionResult New() { var model = new TaskInputModel(); return View("New", model); }
public ActionResult Edit(TaskByIdQuery query) { var task = mediator.Request(query); var model = new TaskInputModel(task); return View("Edit", model); }
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"); }