public static List <ToDoDto> ReadInformation() { List <ToDoDto> informations = new List <ToDoDto>(); using (SqlConnection connection = new SqlConnection(_connectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand()) { command.Connection = connection; command.CommandText = @"SELECT [TaskName] FROM [TaskList]"; using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { var information = new ToDoDto { Name = Convert.ToString(reader["TaskName"]) }; informations.Add(information); } } } } return(informations); }
public int Create(ToDoDto toDoDto) { int Id = GetId(); ToDo todo = new ToDo(Id, toDoDto.Name, false); WorkDatabase.InsertInformation(toDoDto.Name); return(Id); }
public void Update(int id, ToDoDto toDoDto) { WorkDatabase.DeleteInformation(toDoDto.Name); }