public TodoListDto MapToDto(TodoList obj)
        {
            TodoListDto dto = new TodoListDto();

            dto.id          = obj.GetId();
            dto.name        = obj.GetName();
            dto.description = obj.GetDescription();

            return(dto);
        }
 public void Update(TodoList todoList)
 {
     using (NpgsqlConnection connection = DatabaseService.CreateConnection())
     {
         connection.Open();
         NpgsqlCommand query = new NpgsqlCommand("update schedules set name = @name, description= @description where id = @id", connection);
         query.Parameters.AddWithValue("id", todoList.GetId());
         query.Parameters.AddWithValue("task_name", todoList.GetName());
         query.Parameters.AddWithValue("description", todoList.GetDescription());
         query.ExecuteNonQuery();
     }
 }
        public TodoList SaveNew(TodoList todolist)

        {
            using (NpgsqlConnection connection = DatabaseService.CreateConnection())
            {
                connection.Open();
                using (NpgsqlCommand cmd = new NpgsqlCommand(
                           "insert into schedules (name, description) values(@name, @description) returning id", connection))
                {
                    cmd.Parameters.AddWithValue("name", todolist.GetName());
                    cmd.Parameters.AddWithValue("description", todolist.GetDescription());
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            todolist.SetId(reader.GetInt32(0));
                        }
                    }
                }
            }
            return(todolist);
        }