diff --git a/app/src/main/java/com/example/citrusclient/views/CreateTodoFragment.java b/app/src/main/java/com/example/citrusclient/views/CreateTodoFragment.java index 250cbe2..2a2ea34 100644 --- a/app/src/main/java/com/example/citrusclient/views/CreateTodoFragment.java +++ b/app/src/main/java/com/example/citrusclient/views/CreateTodoFragment.java @@ -246,12 +246,16 @@ } if(isEdit){ //編集時 - todosViewModel.setTodo(accountId,editBook.getBookId() ,editTodo.getYear(),editTodo.getMonth(), - editTodo.getDay(), editTodo.getTodoId(), title,spinner.getSelectedItemPosition(), year, month, day, token); + //編集前のTodoは削除 + todosViewModel.deleteTodo(accountId,editBook.getBookId(),editTodo.getYear(), + editTodo.getMonth(),editTodo.getDay(), editTodo.getTodoId(), token); + //編集後の年月日にTodoを追加 + todosViewModel.createTodo(accountId,spinner.getSelectedItemPosition(),year,month,day,title,token); + ((MainActivity)getActivity()).backFragment(); }else{ //追加時 - todosViewModel.createTodo(accountId,spinner.getSelectedItemPosition(),year,month,day,title,token); + todosViewModel.createTodo(accountId,spinner.getSelectedItemPosition(),year,month,day,title ,token); ((MainActivity)getActivity()).backFragment(); }