Exemplo n.º 1
0
        public IActionResult CreateTodo([DataSourceRequest] DataSourceRequest request,
                                        UserTodoItemViewModel model)
        {
            if (model != null && ModelState.IsValid)
            {
                model = todoManager.Create(model);
            }

            return(Json(new[] { model }.ToDataSourceResult(request, ModelState)));
        }
Exemplo n.º 2
0
 public async Task <ApiResponse> Post([FromBody] TodoDto todo)
 => ModelState.IsValid ?
 await _todoManager.Create(todo) :
 new ApiResponse(Status400BadRequest, "Todo Model is Invalid");