Commit 500bff60 authored by Steve Smith's avatar Steve Smith

Using model binding to create command

parent ac22d7f0
......@@ -39,7 +39,7 @@ namespace CleanArchitecture.Web.Api
}
[HttpPost("{itemId}")]
public async Task<IActionResult> MarkComplete(int itemId)
public IActionResult MarkComplete(int itemId)
{
_appService.MarkComplete(itemId);
......
......@@ -7,8 +7,6 @@ using System.Threading.Tasks;
namespace CleanArchitecture.Web.Api
{
[Route("api/[controller]")]
[ValidateModel]
public class ToDoItems3Controller : Controller
......@@ -52,5 +50,13 @@ namespace CleanArchitecture.Web.Api
return Ok();
}
[HttpPost("MarkComplete/{Id}")]
public async Task<IActionResult> MarkComplete(MarkItemCompleteCommand command)
{
await _mediator.Send(command);
return Ok();
}
}
}
......@@ -47,7 +47,7 @@ namespace CleanArchitecture.Web.Api
}
[HttpPost("{itemId}")]
public async Task<IActionResult> MarkComplete(int itemId)
public IActionResult MarkComplete(int itemId)
{
var item = _todoRepository.GetById(itemId);
item.MarkComplete();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment