public IActionResult CreateTodo([DataSourceRequest] DataSourceRequest request, UserTodoItemViewModel model) { if (model != null && ModelState.IsValid) { model = todoManager.Create(model); } return(Json(new[] { model }.ToDataSourceResult(request, ModelState))); }
public async Task <ApiResponse> Post([FromBody] TodoDto todo) => ModelState.IsValid ? await _todoManager.Create(todo) : new ApiResponse(Status400BadRequest, "Todo Model is Invalid");