Beispiel #1
0
        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);
        }
Beispiel #2
0
        public int Create(ToDoDto toDoDto)
        {
            int  Id   = GetId();
            ToDo todo = new ToDo(Id, toDoDto.Name, false);

            WorkDatabase.InsertInformation(toDoDto.Name);
            return(Id);
        }
Beispiel #3
0
 public void Update(int id, ToDoDto toDoDto)
 {
     WorkDatabase.DeleteInformation(toDoDto.Name);
 }