コード例 #1
0
ファイル: TodoService.cs プロジェクト: ksingh1129/playgroud
        public IActionResult UpdateTodoItem(TodoItem todoItem)
        {
            var    jsonFileService    = new JsonFileService();
            string filePath           = "Source/resource.json";
            var    todoItemJsonString = jsonFileService.UpdateTodoItemJsonFile(todoItem, filePath);

            if (!string.IsNullOrEmpty(todoItemJsonString))
            {
                File.WriteAllText(filePath, todoItemJsonString);
                return(new OkObjectResult("Update Success"));
            }

            return(new NotFoundObjectResult("TodoItem is not found."));
        }